{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from galgebra_ipython_helpers import check as check_latex, run\n",
    "os.chdir('../Old Format')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3*e_x + 4*e_y\n",
      "5\n",
      "25\n",
      "3*e_x/5 + 4*e_y/5\n",
      "3*e_x/25 + 4*e_y/25\n",
      "1\n",
      "3*e_x/25 + 4*e_y/25\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "bad_example.py:4: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n"
     ]
    }
   ],
   "source": [
    "run('bad_example')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Frame            = (\u001b[0;34mex\u001b[0m + \u001b[0;34mey\u001b[0m, \u001b[0;34mex\u001b[0m - \u001b[0;34mey\u001b[0m)\n",
      "Reciprocal Frame = (\u001b[0;34mex\u001b[0m/2 + \u001b[0;34mey\u001b[0m/2, \u001b[0;34mex\u001b[0m/2 - \u001b[0;34mey\u001b[0m/2)\n",
      "eu.eu_r = 1\n",
      "eu.ev_r = 0\n",
      "ev.eu_r = 0\n",
      "ev.ev_r = 1\n",
      "Frame            = (\u001b[0;34mex\u001b[0m + \u001b[0;34mey\u001b[0m + \u001b[0;34mez\u001b[0m, \u001b[0;34mex\u001b[0m - \u001b[0;34mey\u001b[0m)\n",
      "Reciprocal Frame = (\u001b[0;34mex\u001b[0m/3 + \u001b[0;34mey\u001b[0m/3 + \u001b[0;34mez\u001b[0m/3, \u001b[0;34mex\u001b[0m/2 - \u001b[0;34mey\u001b[0m/2)\n",
      "eu.eu_r = 1\n",
      "eu.ev_r = 0\n",
      "ev.eu_r = 0\n",
      "ev.ev_r = 1\n",
      "eu = \u001b[0;34mex\u001b[0m + \u001b[0;34mey\u001b[0m + \u001b[0;34mez\u001b[0m\n",
      "ev = \u001b[0;34mex\u001b[0m - \u001b[0;34mey\u001b[0m\n",
      "eu^ev|ex\n",
      "(eu^(ev|ex))\n",
      "\u001b[0;34mex\u001b[0m + \u001b[0;34mey\u001b[0m + \u001b[0;34mez\u001b[0m\n",
      "eu^ev|ex*eu\n",
      "((eu^(ev|ex))*eu)\n",
      "3\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "eval_check.py:5: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV,ReciprocalFrame\n",
      "eval_check.py:19: DeprecationWarning: The `galgebra.deprecated.ReciprocalFrame` function is deprecated in favor of the `ReciprocalFrame` method of `Ga` objects.\n",
      "  (eu_r,ev_r) = ReciprocalFrame([eu,ev])\n",
      "eval_check.py:31: DeprecationWarning: The `galgebra.deprecated.ReciprocalFrame` function is deprecated in favor of the `ReciprocalFrame` method of `Ga` objects.\n",
      "  (eu_r,ev_r) = ReciprocalFrame([eu,ev])\n"
     ]
    }
   ],
   "source": [
    "run('eval_check')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "u__x\u001b[0m*\u001b[0;34me_x\u001b[0m + u__y\u001b[0m*\u001b[0;34me_y\u001b[0m + u__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "v__x\u001b[0m*\u001b[0;34me_x\u001b[0m + v__y\u001b[0m*\u001b[0;34me_y\u001b[0m + v__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "(u__x\u001b[0m*v__y\u001b[0m - u__y\u001b[0m*v__x\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + (u__x\u001b[0m*v__z\u001b[0m - u__z\u001b[0m*v__x\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + (u__y\u001b[0m*v__z\u001b[0m - u__z\u001b[0m*v__y\u001b[0m)*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "True\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "exp_check.py:5: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "exp_check.py:12: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  u = MV('u','vector')\n",
      "exp_check.py:13: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  v = MV('v','vector')\n",
      "exp_check.py:14: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  w = MV('w','vector')\n"
     ]
    }
   ],
   "source": [
    "run('exp_check')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "latex_check.py:7: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "latex_check.py:32: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','mv')\n",
      "latex_check.py:41: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  X = MV('X','vector')\n",
      "latex_check.py:42: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  Y = MV('Y','vector')\n",
      "latex_check.py:60: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  X = MV('X','vector')\n",
      "latex_check.py:61: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','spinor')\n",
      "latex_check.py:77: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  X = MV('X','vector')\n",
      "latex_check.py:78: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','spinor')\n",
      "latex_check.py:115: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  f = MV('f','scalar',fct=True)\n",
      "latex_check.py:116: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n",
      "latex_check.py:117: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','grade2',fct=True)\n",
      "latex_check.py:118: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  C = MV('C','mv')\n",
      "latex_check.py:142: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  f = MV('f','scalar',fct=True)\n",
      "latex_check.py:143: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n",
      "latex_check.py:144: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','grade2',fct=True)\n",
      "latex_check.py:24: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  a = MV(sym_lst,'vector')\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\\documentclass[10pt,fleqn]{report}\n",
       "\\usepackage[vcentering]{geometry}\n",
       "\\geometry{papersize={14in,11in},total={13in,10in}}\n",
       "\n",
       "\\pagestyle{empty}\n",
       "\\usepackage[latin1]{inputenc}\n",
       "\\usepackage{amsmath}\n",
       "\\usepackage{amsfonts}\n",
       "\\usepackage{amssymb}\n",
       "\\usepackage{amsbsy}\n",
       "\\usepackage{tensor}\n",
       "\\usepackage{listings}\n",
       "\\usepackage{color}\n",
       "\\usepackage{xcolor}\n",
       "\\usepackage{bm}\n",
       "\\usepackage{breqn}\n",
       "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n",
       "\\setlength{\\parindent}{0pt}\n",
       "\\DeclareMathOperator{\\Tr}{Tr}\n",
       "\\DeclareMathOperator{\\Adj}{Adj}\n",
       "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n",
       "\\newcommand{\\lp}{\\left (}\n",
       "\\newcommand{\\rp}{\\right )}\n",
       "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n",
       "\\newcommand{\\half}{\\frac{1}{2}}\n",
       "\\newcommand{\\llt}{\\left <}\n",
       "\\newcommand{\\rgt}{\\right >}\n",
       "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n",
       "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n",
       "\\newcommand{\\lbrc}{\\left \\{}\n",
       "\\newcommand{\\rbrc}{\\right \\}}\n",
       "\\newcommand{\\W}{\\wedge}\n",
       "\\newcommand{\\prm}[1]{{#1}'}\n",
       "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n",
       "\\newcommand{\\R}{\\dagger}\n",
       "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n",
       "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n",
       "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n",
       "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n",
       "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n",
       "\\newcommand{\\eb}{\\boldsymbol{e}}\n",
       "\\usepackage{float}\n",
       "\\floatstyle{plain} % optionally change the style of the new float\n",
       "\\newfloat{Code}{H}{myc}\n",
       "\\lstloadlanguages{Python}\n",
       "\n",
       "\\begin{document}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def basic_multivector_operations_3D():\n",
       "    Print_Function()\n",
       "    (ex,ey,ez) = MV.setup('e*x|y|z')\n",
       "    A = MV('A','mv')\n",
       "    A.Fmt(1,'A')\n",
       "    A.Fmt(2,'A')\n",
       "    A.Fmt(3,'A')\n",
       "    A.even().Fmt(1,'%A_{+}')\n",
       "    A.odd().Fmt(1,'%A_{-}')\n",
       "    X = MV('X','vector')\n",
       "    Y = MV('Y','vector')\n",
       "    print('g_{ij} = ',MV.metric)\n",
       "    X.Fmt(1,'X')\n",
       "    Y.Fmt(1,'Y')\n",
       "    (X*Y).Fmt(2,'X*Y')\n",
       "    (X^Y).Fmt(2,'X^Y')\n",
       "    (X|Y).Fmt(2,'X|Y')\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} A = A  + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} A =  \\begin{aligned}[t]  & A  \\\\  &  + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\  &  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}  \\end{aligned} \\end{equation*}\n",
       "\\begin{equation*} A =  \\begin{aligned}[t]  & A  \\\\  &  + A^{x} \\boldsymbol{e}_{x} \\\\  &  + A^{y} \\boldsymbol{e}_{y} \\\\  &  + A^{z} \\boldsymbol{e}_{z} \\\\  &  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\  &  + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}  \\end{aligned} \\end{equation*}\n",
       "\\begin{equation*} g_{ij} =  \\left[\\begin{array}{ccc}\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{x}\\right )  & \\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{y}\\right )  & \\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{z}\\right ) \\\\\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{y}\\right )  & \\left (\\boldsymbol{e}_{y}\\cdot \\boldsymbol{e}_{y}\\right )  & \\left (\\boldsymbol{e}_{y}\\cdot \\boldsymbol{e}_{z}\\right ) \\\\\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{z}\\right )  & \\left (\\boldsymbol{e}_{y}\\cdot \\boldsymbol{e}_{z}\\right )  & \\left (\\boldsymbol{e}_{z}\\cdot \\boldsymbol{e}_{z}\\right ) \\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def basic_multivector_operations_2D():\n",
       "    Print_Function()\n",
       "    (ex,ey) = MV.setup('e*x|y')\n",
       "    print('g_{ij} =',MV.metric)\n",
       "    X = MV('X','vector')\n",
       "    A = MV('A','spinor')\n",
       "    X.Fmt(1,'X')\n",
       "    A.Fmt(1,'A')\n",
       "    (X|A).Fmt(2,'X|A')\n",
       "    (X<A).Fmt(2,'X<A')\n",
       "    (A>X).Fmt(2,'A>X')\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{cc}\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{x}\\right )  & \\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{y}\\right ) \\\\\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{y}\\right )  & \\left (\\boldsymbol{e}_{y}\\cdot \\boldsymbol{e}_{y}\\right ) \\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n",
       "\\begin{equation*} A = A  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def basic_multivector_operations_2D_orthogonal():\n",
       "    Print_Function()\n",
       "    (ex,ey) = MV.setup('e*x|y',metric='[1,1]')\n",
       "    print('g_{ii} =',MV.metric)\n",
       "    X = MV('X','vector')\n",
       "    A = MV('A','spinor')\n",
       "    X.Fmt(1,'X')\n",
       "    A.Fmt(1,'A')\n",
       "    (X*A).Fmt(2,'X*A')\n",
       "    (X|A).Fmt(2,'X|A')\n",
       "    (X<A).Fmt(2,'X<A')\n",
       "    (X>A).Fmt(2,'X>A')\n",
       "    (A*X).Fmt(2,'A*X')\n",
       "    (A|X).Fmt(2,'A|X')\n",
       "    (A<X).Fmt(2,'A<X')\n",
       "    (A>X).Fmt(2,'A>X')\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} g_{ii} = \\left[\\begin{array}{cc}1 & 0\\\\0 & 1\\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n",
       "\\begin{equation*} A = A  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def check_generalized_BAC_CAB_formulas():\n",
       "    Print_Function()\n",
       "    (a,b,c,d) = MV.setup('a b c d')\n",
       "    print('g_{ij} =',MV.metric)\n",
       "    print('\\\\bm{a|(b*c)} =',a|(b*c))\n",
       "    print('\\\\bm{a|(b^c)} =',a|(b^c))\n",
       "    print('\\\\bm{a|(b^c^d)} =',a|(b^c^d))\n",
       "    print('\\\\bm{a|(b^c)+c|(a^b)+b|(c^a)} =',(a|(b^c))+(c|(a^b))+(b|(c^a)))\n",
       "    print('\\\\bm{a*(b^c)-b*(a^c)+c*(a^b)} =',a*(b^c)-b*(a^c)+c*(a^b))\n",
       "    print('\\\\bm{a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c)} =',a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c))\n",
       "    print('\\\\bm{(a^b)|(c^d)} =',(a^b)|(c^d))\n",
       "    print('\\\\bm{((a^b)|c)|d} =',((a^b)|c)|d)\n",
       "    print('\\\\bm{(a^b)\\\\times (c^d)} =',Ga.com(a^b,c^d))\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{cccc}\\left (\\boldsymbol{a}\\cdot \\boldsymbol{a}\\right )  & \\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  & \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right ) \\\\\\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{b}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right ) \\\\\\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{c}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{c}\\cdot \\boldsymbol{d}\\right ) \\\\\\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right )  & \\left (\\boldsymbol{c}\\cdot \\boldsymbol{d}\\right )  & \\left (\\boldsymbol{d}\\cdot \\boldsymbol{d}\\right ) \\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} \\bm{a\\cdot (b c)} = - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{b} + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  \\boldsymbol{c} \\end{equation*}\n",
       "\\begin{equation*} \\bm{a\\cdot (b\\W c)} = - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{b} + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  \\boldsymbol{c} \\end{equation*}\n",
       "\\begin{equation*} \\bm{a\\cdot (b\\W c\\W d)} = \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{b}\\wedge \\boldsymbol{d} + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n",
       "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} =  0 \\end{equation*}\n",
       "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\n",
       "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n",
       "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right )  + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right ) \\end{equation*}\n",
       "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right )  + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right ) \\end{equation*}\n",
       "\\begin{equation*} \\bm{(a\\W b)\\times (c\\W d)} = - \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right )  \\boldsymbol{a}\\wedge \\boldsymbol{c} + \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{a}\\wedge \\boldsymbol{d} + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def rounding_numerical_components():\n",
       "    Print_Function()\n",
       "    (ex,ey,ez) = MV.setup('e_x e_y e_z',metric='[1,1,1]')\n",
       "    X = 1.2*ex+2.34*ey+0.555*ez\n",
       "    Y = 0.333*ex+4*ey+5.3*ez\n",
       "    print('X =',X)\n",
       "    print('Nga(X,2) =',Nga(X,2))\n",
       "    print('X*Y =',X*Y)\n",
       "    print('Nga(X*Y,2) =',Nga(X*Y,2))\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} X = 1.2 \\boldsymbol{e}_{x} + 2.34 \\boldsymbol{e}_{y} + 0.555 \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} Nga(X,2) = 1.2 \\boldsymbol{e}_{x} + 2.3 \\boldsymbol{e}_{y} + 0.55 \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} X Y = 12.7011  + 4.02078 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6.175185 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10.182 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} Nga(X Y,2) = 13.0  + 4.0 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6.2 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10.0 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def derivatives_in_rectangular_coordinates():\n",
       "    Print_Function()\n",
       "    X = (x,y,z) = symbols('x y z')\n",
       "    (ex,ey,ez,grad) = MV.setup('e_x e_y e_z',metric='[1,1,1]',coords=X)\n",
       "    f = MV('f','scalar',fct=True)\n",
       "    A = MV('A','vector',fct=True)\n",
       "    B = MV('B','grade2',fct=True)\n",
       "    C = MV('C','mv')\n",
       "    print('f =',f)\n",
       "    print('A =',A)\n",
       "    print('B =',B)\n",
       "    print('C =',C)\n",
       "    print('grad*f =',grad*f)\n",
       "    print('grad|A =',grad|A)\n",
       "    print('grad*A =',grad*A)\n",
       "    print(-MV.I)\n",
       "    print('-I*(grad^A) =',-MV.I*(grad^A))\n",
       "    print('grad*B =',grad*B)\n",
       "    print('grad^B =',grad^B)\n",
       "    print('grad|B =',grad|B)\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} f = f \\end{equation*}\n",
       "\\begin{equation*} A = A^{x}  \\boldsymbol{e}_{x} + A^{y}  \\boldsymbol{e}_{y} + A^{z}  \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} B = B^{xy}  \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz}  \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz}  \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} C = C  + C^{x} \\boldsymbol{e}_{x} + C^{y} \\boldsymbol{e}_{y} + C^{z} \\boldsymbol{e}_{z} + C^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + C^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + C^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + C^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  f = \\partial_{x} f  \\boldsymbol{e}_{x} + \\partial_{y} f  \\boldsymbol{e}_{y} + \\partial_{z} f  \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{x} A^{x}  + \\partial_{y} A^{y}  + \\partial_{z} A^{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  A = \\left ( \\partial_{x} A^{x}  + \\partial_{y} A^{y}  + \\partial_{z} A^{z} \\right )  + \\left ( - \\partial_{y} A^{x}  + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} A^{x}  + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} A^{y}  + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} - \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\left ( - \\partial_{z} A^{y}  + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{z} A^{x}  - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - \\partial_{y} A^{x}  + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  B = \\left ( - \\partial_{y} B^{xy}  - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy}  - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz}  + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} + \\left ( \\partial_{z} B^{xy}  - \\partial_{y} B^{xz}  + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\left ( \\partial_{z} B^{xy}  - \\partial_{y} B^{xz}  + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot B = \\left ( - \\partial_{y} B^{xy}  - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy}  - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz}  + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def derivatives_in_spherical_coordinates():\n",
       "    Print_Function()\n",
       "    X = (r,th,phi) = symbols('r theta phi')\n",
       "    curv = [[r*cos(phi)*sin(th),r*sin(phi)*sin(th),r*cos(th)],[1,r,r*sin(th)]]\n",
       "    (er,eth,ephi,grad) = MV.setup('e_r e_theta e_phi',metric='[1,1,1]',coords=X,curv=curv)\n",
       "    f = MV('f','scalar',fct=True)\n",
       "    A = MV('A','vector',fct=True)\n",
       "    B = MV('B','grade2',fct=True)\n",
       "    print('f =',f)\n",
       "    print('A =',A)\n",
       "    print('B =',B)\n",
       "    print('grad*f =',grad*f)\n",
       "    print('grad|A =',grad|A)\n",
       "    print('-I*(grad^A) =',(-MV.I*(grad^A)).simplify())\n",
       "    print('grad^B =',grad^B)\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} f = f \\end{equation*}\n",
       "\\begin{equation*} A = A^{r}  \\boldsymbol{e}_{r} + A^{\\theta }  \\boldsymbol{e}_{\\theta } + A^{\\phi }  \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} B = B^{r\\theta }  \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi }  \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi }  \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  f = \\partial_{r} f  \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta  \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta  \\right )}} + \\partial_{\\phi } A^{\\phi }  + \\partial_{r} A^{r}  + \\partial_{\\theta } A^{\\theta }  + \\frac{2 A^{r} }{r} \\end{equation*}\n",
       "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta  \\right )}} + \\partial_{\\theta } A^{\\phi }  - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta  \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta  \\right )}}^{2} \\partial_{r} A^{\\phi }  - 2 r A^{\\phi }  {\\sin{\\left (\\theta  \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta }  + 2 r A^{\\theta }  - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi }  + 4 r B^{\\theta \\phi }  - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta  \\right )}} - \\partial_{\\theta } B^{r\\phi }  + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta  \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def conformal_representations_of_circles_lines_spheres_and_planes():\n",
       "    Print_Function()\n",
       "    global n,nbar\n",
       "    metric = '1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 2,0 0 0 2 0'\n",
       "    (e1,e2,e3,n,nbar) = MV.setup('e_1 e_2 e_3 n \\\\bar{n}',metric)\n",
       "    print('g_{ij} =',MV.metric)\n",
       "    e = n+nbar\n",
       "    #conformal representation of points\n",
       "    A = make_vector(e1)    # point a = (1,0,0)  A = F(a)\n",
       "    B = make_vector(e2)    # point b = (0,1,0)  B = F(b)\n",
       "    C = make_vector(-e1)   # point c = (-1,0,0) C = F(c)\n",
       "    D = make_vector(e3)    # point d = (0,0,1)  D = F(d)\n",
       "    X = make_vector('x',3)\n",
       "    print('F(a) =',A)\n",
       "    print('F(b) =',B)\n",
       "    print('F(c) =',C)\n",
       "    print('F(d) =',D)\n",
       "    print('F(x) =',X)\n",
       "    print('#a = e1, b = e2, c = -e1, and d = e3')\n",
       "    print('#A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.')\n",
       "    print('#Circle through a, b, and c')\n",
       "    print('Circle: A^B^C^X = 0 =',(A^B^C^X))\n",
       "    print('#Line through a and b')\n",
       "    print('Line  : A^B^n^X = 0 =',(A^B^n^X))\n",
       "    print('#Sphere through a, b, c, and d')\n",
       "    print('Sphere: A^B^C^D^X = 0 =',(((A^B)^C)^D)^X)\n",
       "    print('#Plane through a, b, and d')\n",
       "    print('Plane : A^B^n^D^X = 0 =',(A^B^n^D^X))\n",
       "    L = (A^B^e)^X\n",
       "    L.Fmt(3,'Hyperbolic\\\\;\\\\; Circle: (A^B^e)^X = 0')\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{ccccc}1 & 0 & 0 & 0 & 0\\\\0 & 1 & 0 & 0 & 0\\\\0 & 0 & 1 & 0 & 0\\\\0 & 0 & 0 & 0 & 2\\\\0 & 0 & 0 & 2 & 0\\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} F(a) =  \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "\\begin{equation*} F(b) =  \\boldsymbol{e}_{2} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "\\begin{equation*} F(c) = - \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "\\begin{equation*} F(d) =  \\boldsymbol{e}_{3} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "\\begin{equation*} F(x) = x_{1} \\boldsymbol{e}_{1} + x_{2} \\boldsymbol{e}_{2} + x_{3} \\boldsymbol{e}_{3} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2}\\right ) \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "a = e1, b = e2, c = -e1, and d = e3\n",
       "A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.\n",
       "Circle through a, b, and c\n",
       "\\begin{equation*} Circle: A\\W B\\W C\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{\\bar{n}} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "Line through a and b\n",
       "\\begin{equation*} Line  : A\\W B\\W n\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + \\left ( \\frac{x_{1}}{2} + \\frac{x_{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} + \\frac{x_{3}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} - \\frac{x_{3}}{2} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "Sphere through a, b, c, and d\n",
       "\\begin{equation*} Sphere: A\\W B\\W C\\W D\\W X = 0 = \\left ( - \\frac{{\\left ( x_{1} \\right )}^{2}}{2} - \\frac{{\\left ( x_{2} \\right )}^{2}}{2} - \\frac{{\\left ( x_{3} \\right )}^{2}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "Plane through a, b, and d\n",
       "\\begin{equation*} Plane : A\\W B\\W n\\W D\\W X = 0 = \\left ( - \\frac{x_{1}}{2} - \\frac{x_{2}}{2} - \\frac{x_{3}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def properties_of_geometric_objects():\n",
       "    global n,nbar\n",
       "    Print_Function()\n",
       "    metric = '# # # 0 0,'+ \\\n",
       "             '# # # 0 0,'+ \\\n",
       "             '# # # 0 0,'+ \\\n",
       "             '0 0 0 0 2,'+ \\\n",
       "             '0 0 0 2 0'\n",
       "    (p1,p2,p3,n,nbar) = MV.setup('p1 p2 p3 n \\\\bar{n}',metric)\n",
       "    print('g_{ij} =',MV.metric)\n",
       "    P1 = F(p1)\n",
       "    P2 = F(p2)\n",
       "    P3 = F(p3)\n",
       "    print('#%\\\\text{Extracting direction of line from }L = P1\\\\W P2\\\\W n')\n",
       "    L = P1^P2^n\n",
       "    delta = (L|n)|nbar\n",
       "    print('(L|n)|\\\\bar{n} =',delta)\n",
       "    print('#%\\\\text{Extracting plane of circle from }C = P1\\\\W P2\\\\W P3')\n",
       "    C = P1^P2^P3\n",
       "    delta = ((C^n)|n)|nbar\n",
       "    print('((C^n)|n)|\\\\bar{n}=',delta)\n",
       "    print('(p2-p1)^(p3-p1)=',(p2-p1)^(p3-p1))\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{ccccc}\\left (\\boldsymbol{p}_{1}\\cdot \\boldsymbol{p}_{1}\\right )  & \\left (\\boldsymbol{p}_{1}\\cdot \\boldsymbol{p}_{2}\\right )  & \\left (\\boldsymbol{p}_{1}\\cdot \\boldsymbol{p}_{3}\\right )  & 0 & 0\\\\\\left (\\boldsymbol{p}_{1}\\cdot \\boldsymbol{p}_{2}\\right )  & \\left (\\boldsymbol{p}_{2}\\cdot \\boldsymbol{p}_{2}\\right )  & \\left (\\boldsymbol{p}_{2}\\cdot \\boldsymbol{p}_{3}\\right )  & 0 & 0\\\\\\left (\\boldsymbol{p}_{1}\\cdot \\boldsymbol{p}_{3}\\right )  & \\left (\\boldsymbol{p}_{2}\\cdot \\boldsymbol{p}_{3}\\right )  & \\left (\\boldsymbol{p}_{3}\\cdot \\boldsymbol{p}_{3}\\right )  & 0 & 0\\\\0 & 0 & 0 & 0 & 2\\\\0 & 0 & 0 & 2 & 0\\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} \\text{Extracting direction of line from }L = P1\\W P2\\W n \\end{equation*}\n",
       "\\begin{equation*} (L\\cdot n)\\cdot \\bar{n} = 2 \\boldsymbol{p}_{1} -2 \\boldsymbol{p}_{2} \\end{equation*}\n",
       "\\begin{equation*} \\text{Extracting plane of circle from }C = P1\\W P2\\W P3 \\end{equation*}\n",
       "\\begin{equation*} ((C\\W n)\\cdot n)\\cdot \\bar{n}= 2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} -2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} + 2 \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{equation*}\n",
       "\\begin{equation*} (p2-p1)\\W (p3-p1)=  \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} - \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} + \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def extracting_vectors_from_conformal_2_blade():\n",
       "    Print_Function()\n",
       "    print(r'B = P1\\W P2')\n",
       "    metric = '0 -1 #,'+ \\\n",
       "             '-1 0 #,'+ \\\n",
       "             '# # #'\n",
       "    (P1,P2,a) = MV.setup('P1 P2 a',metric)\n",
       "    print('g_{ij} =',MV.metric)\n",
       "    B = P1^P2\n",
       "    Bsq = B*B\n",
       "    print('%B^{2} =',Bsq)\n",
       "    ap = a-(a^B)*B\n",
       "    print(\"a' = a-(a^B)*B =\",ap)\n",
       "    Ap = ap+ap*B\n",
       "    Am = ap-ap*B\n",
       "    print(\"A+ = a'+a'*B =\",Ap)\n",
       "    print(\"A- = a'-a'*B =\",Am)\n",
       "    print('%(A+)^{2} =',Ap*Ap)\n",
       "    print('%(A-)^{2} =',Am*Am)\n",
       "    aB = a|B\n",
       "    print('a|B =',aB)\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} B = P1\\W P2 \\end{equation*}\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{ccc}0 & -1 & \\left (\\boldsymbol{P}_{1}\\cdot \\boldsymbol{a}\\right ) \\\\-1 & 0 & \\left (\\boldsymbol{P}_{2}\\cdot \\boldsymbol{a}\\right ) \\\\\\left (\\boldsymbol{P}_{1}\\cdot \\boldsymbol{a}\\right )  & \\left (\\boldsymbol{P}_{2}\\cdot \\boldsymbol{a}\\right )  & \\left (\\boldsymbol{a}\\cdot \\boldsymbol{a}\\right ) \\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} B^{2} = 1 \\end{equation*}\n",
       "\\begin{equation*} a' = a-(a\\W B) B = - \\left (\\boldsymbol{P}_{2}\\cdot \\boldsymbol{a}\\right )  \\boldsymbol{P}_{1} - \\left (\\boldsymbol{P}_{1}\\cdot \\boldsymbol{a}\\right )  \\boldsymbol{P}_{2} \\end{equation*}\n",
       "\\begin{equation*} A+ = a'+a' B = - 2 \\left (\\boldsymbol{P}_{2}\\cdot \\boldsymbol{a}\\right )  \\boldsymbol{P}_{1} \\end{equation*}\n",
       "\\begin{equation*} A- = a'-a' B = - 2 \\left (\\boldsymbol{P}_{1}\\cdot \\boldsymbol{a}\\right )  \\boldsymbol{P}_{2} \\end{equation*}\n",
       "\\begin{equation*} (A+)^{2} =  0 \\end{equation*}\n",
       "\\begin{equation*} (A-)^{2} =  0 \\end{equation*}\n",
       "\\begin{equation*} a\\cdot B = - \\left (\\boldsymbol{P}_{2}\\cdot \\boldsymbol{a}\\right )  \\boldsymbol{P}_{1} + \\left (\\boldsymbol{P}_{1}\\cdot \\boldsymbol{a}\\right )  \\boldsymbol{P}_{2} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def reciprocal_frame_test():\n",
       "    Print_Function()\n",
       "    metric = '1 # #,'+ \\\n",
       "             '# 1 #,'+ \\\n",
       "             '# # 1'\n",
       "    (e1,e2,e3) = MV.setup('e1 e2 e3',metric)\n",
       "    print('g_{ij} =',MV.metric)\n",
       "    E = e1^e2^e3\n",
       "    Esq = (E*E).scalar()\n",
       "    print('E =',E)\n",
       "    print('%E^{2} =',Esq)\n",
       "    Esq_inv = 1/Esq\n",
       "    E1 = (e2^e3)*E\n",
       "    E2 = (-1)*(e1^e3)*E\n",
       "    E3 = (e1^e2)*E\n",
       "    print('E1 = (e2^e3)*E =',E1)\n",
       "    print('E2 =-(e1^e3)*E =',E2)\n",
       "    print('E3 = (e1^e2)*E =',E3)\n",
       "    w = (E1|e2)\n",
       "    w = w.expand()\n",
       "    print('E1|e2 =',w)\n",
       "    w = (E1|e3)\n",
       "    w = w.expand()\n",
       "    print('E1|e3 =',w)\n",
       "    w = (E2|e1)\n",
       "    w = w.expand()\n",
       "    print('E2|e1 =',w)\n",
       "    w = (E2|e3)\n",
       "    w = w.expand()\n",
       "    print('E2|e3 =',w)\n",
       "    w = (E3|e1)\n",
       "    w = w.expand()\n",
       "    print('E3|e1 =',w)\n",
       "    w = (E3|e2)\n",
       "    w = w.expand()\n",
       "    print('E3|e2 =',w)\n",
       "    w = (E1|e1)\n",
       "    w = (w.expand()).scalar()\n",
       "    Esq = expand(Esq)\n",
       "    print('%(E1\\\\cdot e1)/E^{2} =',simplify(w/Esq))\n",
       "    w = (E2|e2)\n",
       "    w = (w.expand()).scalar()\n",
       "    print('%(E2\\\\cdot e2)/E^{2} =',simplify(w/Esq))\n",
       "    w = (E3|e3)\n",
       "    w = (w.expand()).scalar()\n",
       "    print('%(E3\\\\cdot e3)/E^{2} =',simplify(w/Esq))\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{ccc}1 & \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  & \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) \\\\\\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  & 1 & \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\\\\\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  & \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right )  & 1\\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} E =  \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n",
       "\\begin{equation*} E^{2} = \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right ) ^{2} - 2 \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) ^{2} + \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) ^{2} - 1 \\end{equation*}\n",
       "\\begin{equation*} E1 = (e2\\W e3) E = \\left ( \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} + \\left ( \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{2} + \\left ( - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{equation*}\n",
       "\\begin{equation*} E2 =-(e1\\W e3) E = \\left ( \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{1} + \\left ( \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} + \\left ( - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{equation*}\n",
       "\\begin{equation*} E3 = (e1\\W e2) E = \\left ( - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{1} + \\left ( - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{2} + \\left ( \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{equation*}\n",
       "\\begin{equation*} E1\\cdot e2 =  0 \\end{equation*}\n",
       "\\begin{equation*} E1\\cdot e3 =  0 \\end{equation*}\n",
       "\\begin{equation*} E2\\cdot e1 =  0 \\end{equation*}\n",
       "\\begin{equation*} E2\\cdot e3 =  0 \\end{equation*}\n",
       "\\begin{equation*} E3\\cdot e1 =  0 \\end{equation*}\n",
       "\\begin{equation*} E3\\cdot e2 =  0 \\end{equation*}\n",
       "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\n",
       "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\n",
       "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\n",
       "\\end{document}\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "check_latex('latex_check')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\n",
       "\\documentclass[10pt,fleqn]{report}\n",
       "\\usepackage[vcentering]{geometry}\n",
       "\\geometry{papersize={14in,11in},total={13in,10in}}\n",
       "\n",
       "\\pagestyle{empty}\n",
       "\\usepackage[latin1]{inputenc}\n",
       "\\usepackage{amsmath}\n",
       "\\usepackage{amsfonts}\n",
       "\\usepackage{amssymb}\n",
       "\\usepackage{amsbsy}\n",
       "\\usepackage{tensor}\n",
       "\\usepackage{listings}\n",
       "\\usepackage{color}\n",
       "\\usepackage{xcolor}\n",
       "\\usepackage{bm}\n",
       "\\usepackage{breqn}\n",
       "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n",
       "\\setlength{\\parindent}{0pt}\n",
       "\\DeclareMathOperator{\\Tr}{Tr}\n",
       "\\DeclareMathOperator{\\Adj}{Adj}\n",
       "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n",
       "\\newcommand{\\lp}{\\left (}\n",
       "\\newcommand{\\rp}{\\right )}\n",
       "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n",
       "\\newcommand{\\half}{\\frac{1}{2}}\n",
       "\\newcommand{\\llt}{\\left <}\n",
       "\\newcommand{\\rgt}{\\right >}\n",
       "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n",
       "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n",
       "\\newcommand{\\lbrc}{\\left \\{}\n",
       "\\newcommand{\\rbrc}{\\right \\}}\n",
       "\\newcommand{\\W}{\\wedge}\n",
       "\\newcommand{\\prm}[1]{{#1}'}\n",
       "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n",
       "\\newcommand{\\R}{\\dagger}\n",
       "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n",
       "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n",
       "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n",
       "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n",
       "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n",
       "\\newcommand{\\eb}{\\boldsymbol{e}}\n",
       "\\usepackage{float}\n",
       "\\floatstyle{plain} % optionally change the style of the new float\n",
       "\\newfloat{Code}{H}{myc}\n",
       "\\lstloadlanguages{Python}\n",
       "\n",
       "\\begin{document}\n",
       "\\begin{equation*} \\left[\\begin{array}{cc}1 & 2\\\\3 & 4\\end{array}\\right] \\left[\\begin{array}{c}5\\\\6\\end{array}\\right] = \\left[\\begin{array}{c}17\\\\39\\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} \\left[\\begin{array}{cc}x^{3} & y^{3}\\end{array}\\right] \\left[\\begin{array}{cc}x^{2} & 2 x y\\\\2 x y & y^{2}\\end{array}\\right] = \\left[\\begin{array}{cc}x^{5} + 2 x y^{4} & 2 x^{4} y + y^{5}\\end{array}\\right] \\end{equation*}\n",
       "\\end{document}\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "check_latex('matrix_latex')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "v__1\u001b[0m*\u001b[0;34me_1\u001b[0m + v__2\u001b[0m*\u001b[0;34me_2\u001b[0m + v__3\u001b[0m*\u001b[0;34me_3\u001b[0m\n",
      "v__1\u001b[0m*\u001b[0;34me_1\u001b[0m + v__2\u001b[0m*\u001b[0;34me_2\u001b[0m + v__3\u001b[0m*\u001b[0;34me_3\u001b[0m\n",
      "v__x\u001b[0m*\u001b[0;34me_x\u001b[0m + v__y\u001b[0m*\u001b[0;34me_y\u001b[0m + v__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "v__x*\u001b[0;34me_x\u001b[0m + v__y*\u001b[0;34me_y\u001b[0m + v__z*\u001b[0;34me_z\u001b[0m\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "mv_setup_options.py:3: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "mv_setup_options.py:8: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  v = MV('v', 'vector')\n",
      "mv_setup_options.py:12: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  v = MV('v', 'vector')\n",
      "mv_setup_options.py:16: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  v = MV('v', 'vector')\n",
      "mv_setup_options.py:21: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  v = MV('v', 'vector')\n"
     ]
    }
   ],
   "source": [
    "run('mv_setup_options')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "physics_check_latex.py:6: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "physics_check_latex.py:14: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','vector',fct=True)\n",
      "physics_check_latex.py:15: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  E = MV('E','vector',fct=True)\n",
      "physics_check_latex.py:20: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  J = MV('J','vector',fct=True)\n",
      "physics_check_latex.py:48: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  psi = MV('psi','spinor',fct=True)\n",
      "physics_check_latex.py:49: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\\documentclass[10pt,fleqn]{report}\n",
       "\\usepackage[vcentering]{geometry}\n",
       "\\geometry{papersize={14in,11in},total={13in,10in}}\n",
       "\n",
       "\\pagestyle{empty}\n",
       "\\usepackage[latin1]{inputenc}\n",
       "\\usepackage{amsmath}\n",
       "\\usepackage{amsfonts}\n",
       "\\usepackage{amssymb}\n",
       "\\usepackage{amsbsy}\n",
       "\\usepackage{tensor}\n",
       "\\usepackage{listings}\n",
       "\\usepackage{color}\n",
       "\\usepackage{xcolor}\n",
       "\\usepackage{bm}\n",
       "\\usepackage{breqn}\n",
       "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n",
       "\\setlength{\\parindent}{0pt}\n",
       "\\DeclareMathOperator{\\Tr}{Tr}\n",
       "\\DeclareMathOperator{\\Adj}{Adj}\n",
       "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n",
       "\\newcommand{\\lp}{\\left (}\n",
       "\\newcommand{\\rp}{\\right )}\n",
       "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n",
       "\\newcommand{\\half}{\\frac{1}{2}}\n",
       "\\newcommand{\\llt}{\\left <}\n",
       "\\newcommand{\\rgt}{\\right >}\n",
       "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n",
       "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n",
       "\\newcommand{\\lbrc}{\\left \\{}\n",
       "\\newcommand{\\rbrc}{\\right \\}}\n",
       "\\newcommand{\\W}{\\wedge}\n",
       "\\newcommand{\\prm}[1]{{#1}'}\n",
       "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n",
       "\\newcommand{\\R}{\\dagger}\n",
       "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n",
       "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n",
       "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n",
       "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n",
       "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n",
       "\\newcommand{\\eb}{\\boldsymbol{e}}\n",
       "\\usepackage{float}\n",
       "\\floatstyle{plain} % optionally change the style of the new float\n",
       "\\newfloat{Code}{H}{myc}\n",
       "\\lstloadlanguages{Python}\n",
       "\n",
       "\\begin{document}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def Maxwells_Equations_in_Geometric_Calculus():\n",
       "    Print_Function()\n",
       "    X = symbols('t x y z')\n",
       "    (g0,g1,g2,g3,grad) = MV.setup('gamma*t|x|y|z',metric='[1,-1,-1,-1]',coords=X)\n",
       "    I = MV.I\n",
       "    B = MV('B','vector',fct=True)\n",
       "    E = MV('E','vector',fct=True)\n",
       "    B.set_coef(1,0,0)\n",
       "    E.set_coef(1,0,0)\n",
       "    B *= g0\n",
       "    E *= g0\n",
       "    J = MV('J','vector',fct=True)\n",
       "    F = E+I*B\n",
       "    print(r'\\text{Pseudo Scalar\\;\\;}I =',I)\n",
       "    print('\\\\text{Magnetic Field Bi-Vector\\\\;\\\\;} B = \\\\bm{B\\\\gamma_{t}} =',B)\n",
       "    print('\\\\text{Electric Field Bi-Vector\\\\;\\\\;} E = \\\\bm{E\\\\gamma_{t}} =',E)\n",
       "    print('\\\\text{Electromagnetic Field Bi-Vector\\\\;\\\\;} F = E+IB =',F)\n",
       "    print('%\\\\text{Four Current Density\\\\;\\\\;} J =',J)\n",
       "    gradF = grad*F\n",
       "    print('#Geometric Derivative of Electomagnetic Field Bi-Vector')\n",
       "    gradF.Fmt(3,'grad*F')\n",
       "    print('#Maxwell Equations')\n",
       "    print('grad*F = J')\n",
       "    print('#Div $E$ and Curl $H$ Equations')\n",
       "    (gradF.grade(1)-J).Fmt(3,'%\\\\grade{\\\\nabla F}_{1} -J = 0')\n",
       "    print('#Curl $E$ and Div $B$ equations')\n",
       "    (gradF.grade(3)).Fmt(3,'%\\\\grade{\\\\nabla F}_{3} = 0')\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} \\text{Pseudo Scalar\\;\\;}I =  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} \\text{Magnetic Field Bi-Vector\\;\\;} B = \\bm{B\\gamma_{t}} = - B^{x}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - B^{y}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - B^{z}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} \\text{Electric Field Bi-Vector\\;\\;} E = \\bm{E\\gamma_{t}} = - E^{x}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - E^{y}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - E^{z}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} \\text{Electromagnetic Field Bi-Vector\\;\\;} F = E+IB = - E^{x}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - E^{y}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - E^{z}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} - B^{z}  \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} + B^{y}  \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} - B^{x}  \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} \\text{Four Current Density\\;\\;} J = J^{t}  \\boldsymbol{\\gamma }_{t} + J^{x}  \\boldsymbol{\\gamma }_{x} + J^{y}  \\boldsymbol{\\gamma }_{y} + J^{z}  \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "Geometric Derivative of Electomagnetic Field Bi-Vector\n",
       "Maxwell Equations\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  F = J \\end{equation*}\n",
       "Div $E$ and Curl $H$ Equations\n",
       "Curl $E$ and Div $B$ equations\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def Dirac_Equation_in_Geometric_Calculus():\n",
       "    Print_Function()\n",
       "    vars = symbols('t x y z')\n",
       "    (g0,g1,g2,g3,grad) = MV.setup('gamma*t|x|y|z',metric='[1,-1,-1,-1]',coords=vars)\n",
       "    I = MV.I\n",
       "    (m,e) = symbols('m e')\n",
       "    psi = MV('psi','spinor',fct=True)\n",
       "    A = MV('A','vector',fct=True)\n",
       "    sig_z = g3*g0\n",
       "    print('\\\\text{4-Vector Potential\\\\;\\\\;}\\\\bm{A} =',A)\n",
       "    print('\\\\text{8-component real spinor\\\\;\\\\;}\\\\bm{\\\\psi} =',psi)\n",
       "    dirac_eq = (grad*psi)*I*sig_z-e*A*psi-m*psi*g0\n",
       "    dirac_eq.simplify()\n",
       "    dirac_eq.Fmt(3,r'%\\text{Dirac Equation\\;\\;}\\nabla \\bm{\\psi} I \\sigma_{z}-e\\bm{A}\\bm{\\psi}-m\\bm{\\psi}\\gamma_{t} = 0')\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} \\text{4-Vector Potential\\;\\;}\\bm{A} = A^{t}  \\boldsymbol{\\gamma }_{t} + A^{x}  \\boldsymbol{\\gamma }_{x} + A^{y}  \\boldsymbol{\\gamma }_{y} + A^{z}  \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} \\text{8-component real spinor\\;\\;}\\bm{\\psi} = \\psi    + \\psi ^{tx}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} + \\psi ^{ty}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} + \\psi ^{tz}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} + \\psi ^{xy}  \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} + \\psi ^{xz}  \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} + \\psi ^{yz}  \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} + \\psi ^{txyz}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def Lorentz_Tranformation_in_Geometric_Algebra():\n",
       "    Print_Function()\n",
       "    (alpha,beta,gamma) = symbols('alpha beta gamma')\n",
       "    (x,t,xp,tp) = symbols(\"x t x' t'\")\n",
       "    (g0,g1) = MV.setup('gamma*t|x',metric='[1,-1]')\n",
       "    from sympy import sinh,cosh\n",
       "    R = cosh(alpha/2)+sinh(alpha/2)*(g0^g1)\n",
       "    X = t*g0+x*g1\n",
       "    Xp = tp*g0+xp*g1\n",
       "    print('R =',R)\n",
       "    print(r\"#%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger}\")\n",
       "    Xpp = R*Xp*R.rev()\n",
       "    Xpp = Xpp.collect()\n",
       "    Xpp = Xpp.subs({2*sinh(alpha/2)*cosh(alpha/2):sinh(alpha),sinh(alpha/2)**2+cosh(alpha/2)**2:cosh(alpha)})\n",
       "    print(r\"%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} =\",Xpp)\n",
       "    Xpp = Xpp.subs({sinh(alpha):gamma*beta,cosh(alpha):gamma})\n",
       "    print(r'%\\f{\\sinh}{\\alpha} = \\gamma\\beta')\n",
       "    print(r'%\\f{\\cosh}{\\alpha} = \\gamma')\n",
       "    print(r\"%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} =\",Xpp.collect())\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} R = \\cosh{\\left (\\frac{\\alpha }{2} \\right )}  + \\sinh{\\left (\\frac{\\alpha }{2} \\right )} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\end{equation*}\n",
       "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger} \\end{equation*}\n",
       "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = \\left ( 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t' - x' \\sinh{\\left (\\alpha  \\right )}\\right ) \\boldsymbol{\\gamma }_{t} + \\left ( - t' \\sinh{\\left (\\alpha  \\right )} + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{equation*}\n",
       "\\begin{equation*} \\f{\\sinh}{\\alpha} = \\gamma\\beta \\end{equation*}\n",
       "\\begin{equation*} \\f{\\cosh}{\\alpha} = \\gamma \\end{equation*}\n",
       "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = \\left ( - \\beta  \\gamma  x' + 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t'\\right ) \\boldsymbol{\\gamma }_{t} + \\left ( - \\beta  \\gamma  t' + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{equation*}\n",
       "\\end{document}\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "check_latex('physics_check_latex')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "print_check_latex.py:5: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "print_check_latex.py:11: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','mv')\n",
      "print_check_latex.py:19: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  f = MV('f','scalar',fct=True)\n",
      "print_check_latex.py:20: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n",
      "print_check_latex.py:21: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','grade2',fct=True)\n",
      "print_check_latex.py:88: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  f = MV('f','scalar',fct=True)\n",
      "print_check_latex.py:89: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n",
      "print_check_latex.py:90: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','grade2',fct=True)\n",
      "print_check_latex.py:104: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','vector',fct=True)\n",
      "print_check_latex.py:105: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  E = MV('E','vector',fct=True)\n",
      "print_check_latex.py:110: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  J = MV('J','vector',fct=True)\n",
      "print_check_latex.py:152: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  psi = MV('psi','spinor',fct=True)\n",
      "print_check_latex.py:153: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\\documentclass[10pt,fleqn]{report}\n",
       "\\usepackage[vcentering]{geometry}\n",
       "\\geometry{papersize={14in,11in},total={13in,10in}}\n",
       "\n",
       "\\pagestyle{empty}\n",
       "\\usepackage[latin1]{inputenc}\n",
       "\\usepackage{amsmath}\n",
       "\\usepackage{amsfonts}\n",
       "\\usepackage{amssymb}\n",
       "\\usepackage{amsbsy}\n",
       "\\usepackage{tensor}\n",
       "\\usepackage{listings}\n",
       "\\usepackage{color}\n",
       "\\usepackage{xcolor}\n",
       "\\usepackage{bm}\n",
       "\\usepackage{breqn}\n",
       "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n",
       "\\setlength{\\parindent}{0pt}\n",
       "\\DeclareMathOperator{\\Tr}{Tr}\n",
       "\\DeclareMathOperator{\\Adj}{Adj}\n",
       "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n",
       "\\newcommand{\\lp}{\\left (}\n",
       "\\newcommand{\\rp}{\\right )}\n",
       "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n",
       "\\newcommand{\\half}{\\frac{1}{2}}\n",
       "\\newcommand{\\llt}{\\left <}\n",
       "\\newcommand{\\rgt}{\\right >}\n",
       "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n",
       "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n",
       "\\newcommand{\\lbrc}{\\left \\{}\n",
       "\\newcommand{\\rbrc}{\\right \\}}\n",
       "\\newcommand{\\W}{\\wedge}\n",
       "\\newcommand{\\prm}[1]{{#1}'}\n",
       "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n",
       "\\newcommand{\\R}{\\dagger}\n",
       "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n",
       "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n",
       "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n",
       "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n",
       "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n",
       "\\newcommand{\\eb}{\\boldsymbol{e}}\n",
       "\\usepackage{float}\n",
       "\\floatstyle{plain} % optionally change the style of the new float\n",
       "\\newfloat{Code}{H}{myc}\n",
       "\\lstloadlanguages{Python}\n",
       "\n",
       "\\begin{document}\n",
       "\\begin{equation*} \\bm{A} = A  + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\bm{A} =  \\begin{aligned}[t]  & A  \\\\  &  + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\  &  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}  \\end{aligned} \\end{equation*}\n",
       "\\begin{equation*} \\bm{A} =  \\begin{aligned}[t]  & A  \\\\  &  + A^{x} \\boldsymbol{e}_{x} \\\\  &  + A^{y} \\boldsymbol{e}_{y} \\\\  &  + A^{z} \\boldsymbol{e}_{z} \\\\  &  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\  &  + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}  \\end{aligned} \\end{equation*}\n",
       "\\begin{equation*} \\bm{A} = A^{x}  \\boldsymbol{e}_{x} + A^{y}  \\boldsymbol{e}_{y} + A^{z}  \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\bm{B} = B^{xy}  \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz}  \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz}  \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  f = \\partial_{x} f  \\boldsymbol{e}_{x} + \\partial_{y} f  \\boldsymbol{e}_{y} + \\partial_{z} f  \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot \\bm{A} = \\partial_{x} A^{x}  + \\partial_{y} A^{y}  + \\partial_{z} A^{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  \\bm{A} = \\left ( \\partial_{x} A^{x}  + \\partial_{y} A^{y}  + \\partial_{z} A^{z} \\right )  + \\left ( - \\partial_{y} A^{x}  + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} A^{x}  + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} A^{y}  + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W \\bm{A}) = \\left ( - \\partial_{z} A^{y}  + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{z} A^{x}  - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - \\partial_{y} A^{x}  + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  \\bm{B} = \\left ( - \\partial_{y} B^{xy}  - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy}  - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz}  + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} + \\left ( \\partial_{z} B^{xy}  - \\partial_{y} B^{xz}  + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\W \\bm{B} = \\left ( \\partial_{z} B^{xy}  - \\partial_{y} B^{xz}  + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot \\bm{B} = \\left ( - \\partial_{y} B^{xy}  - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy}  - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz}  + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{cccc}\\left (\\boldsymbol{a}\\cdot \\boldsymbol{a}\\right )  & \\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  & \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right ) \\\\\\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{b}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right ) \\\\\\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{c}\\cdot \\boldsymbol{c}\\right )  & \\left (\\boldsymbol{c}\\cdot \\boldsymbol{d}\\right ) \\\\\\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  & \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right )  & \\left (\\boldsymbol{c}\\cdot \\boldsymbol{d}\\right )  & \\left (\\boldsymbol{d}\\cdot \\boldsymbol{d}\\right ) \\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} \\bm{a\\cdot (b c)} = - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{b} + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  \\boldsymbol{c} \\end{equation*}\n",
       "\\begin{equation*} \\bm{a\\cdot (b\\W c)} = - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{b} + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  \\boldsymbol{c} \\end{equation*}\n",
       "\\begin{equation*} \\bm{a\\cdot (b\\W c\\W d)} = \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{b}\\wedge \\boldsymbol{d} + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{b}\\right )  \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n",
       "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} =  0 \\end{equation*}\n",
       "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\n",
       "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n",
       "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right )  + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right ) \\end{equation*}\n",
       "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right )  + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right ) \\end{equation*}\n",
       "\\begin{equation*} \\bm{(a\\W b)\\times (c\\W d)} = - \\left (\\boldsymbol{b}\\cdot \\boldsymbol{d}\\right )  \\boldsymbol{a}\\wedge \\boldsymbol{c} + \\left (\\boldsymbol{b}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{a}\\wedge \\boldsymbol{d} + \\left (\\boldsymbol{a}\\cdot \\boldsymbol{d}\\right )  \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left (\\boldsymbol{a}\\cdot \\boldsymbol{c}\\right )  \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{equation*}\n",
       "\\begin{equation*} E =  \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n",
       "\\begin{equation*} E^{2} = \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right ) ^{2} - 2 \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) ^{2} + \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) ^{2} - 1 \\end{equation*}\n",
       "\\begin{equation*} E1 = (e2\\W e3) E = \\left ( \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} + \\left ( \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{2} + \\left ( - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{equation*}\n",
       "\\begin{equation*} E2 =-(e1\\W e3) E = \\left ( \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{1} + \\left ( \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} + \\left ( - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{equation*}\n",
       "\\begin{equation*} E3 = (e1\\W e2) E = \\left ( - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{1} + \\left ( - \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right )  \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{3}\\right )  + \\left (\\boldsymbol{e}_{2}\\cdot \\boldsymbol{e}_{3}\\right ) \\right ) \\boldsymbol{e}_{2} + \\left ( \\left (\\boldsymbol{e}_{1}\\cdot \\boldsymbol{e}_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{equation*}\n",
       "\\begin{equation*} E1\\cdot e2 =  0 \\end{equation*}\n",
       "\\begin{equation*} E1\\cdot e3 =  0 \\end{equation*}\n",
       "\\begin{equation*} E2\\cdot e1 =  0 \\end{equation*}\n",
       "\\begin{equation*} E2\\cdot e3 =  0 \\end{equation*}\n",
       "\\begin{equation*} E3\\cdot e1 =  0 \\end{equation*}\n",
       "\\begin{equation*} E3\\cdot e2 =  0 \\end{equation*}\n",
       "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\n",
       "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\n",
       "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\n",
       "\\begin{equation*} A = A^{r}  \\boldsymbol{e}_{r} + A^{\\theta }  \\boldsymbol{e}_{\\theta } + A^{\\phi }  \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} B = B^{r\\theta }  \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi }  \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi }  \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  f = \\partial_{r} f  \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta  \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta  \\right )}} + \\partial_{\\phi } A^{\\phi }  + \\partial_{r} A^{r}  + \\partial_{\\theta } A^{\\theta }  + \\frac{2 A^{r} }{r} \\end{equation*}\n",
       "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta  \\right )}} + \\partial_{\\theta } A^{\\phi }  - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta  \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta  \\right )}}^{2} \\partial_{r} A^{\\phi }  - 2 r A^{\\phi }  {\\sin{\\left (\\theta  \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta }  + 2 r A^{\\theta }  - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi }  + 4 r B^{\\theta \\phi }  - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta  \\right )}} - \\partial_{\\theta } B^{r\\phi }  + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta  \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} B = \\bm{B\\gamma_{t}} = - B^{x}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - B^{y}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - B^{z}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} E = \\bm{E\\gamma_{t}} = - E^{x}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - E^{y}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - E^{z}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} F = E+IB = - E^{x}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - E^{y}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - E^{z}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} - B^{z}  \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} + B^{y}  \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} - B^{x}  \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} J = J^{t}  \\boldsymbol{\\gamma }_{t} + J^{x}  \\boldsymbol{\\gamma }_{x} + J^{y}  \\boldsymbol{\\gamma }_{y} + J^{z}  \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  F = J \\end{equation*}\n",
       "\\begin{equation*} R = \\cosh{\\left (\\frac{\\alpha }{2} \\right )}  + \\sinh{\\left (\\frac{\\alpha }{2} \\right )} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\end{equation*}\n",
       "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger} \\end{equation*}\n",
       "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = \\left ( 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t' - x' \\sinh{\\left (\\alpha  \\right )}\\right ) \\boldsymbol{\\gamma }_{t} + \\left ( - t' \\sinh{\\left (\\alpha  \\right )} + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{equation*}\n",
       "\\begin{equation*} \\f{\\sinh}{\\alpha} = \\gamma\\beta \\end{equation*}\n",
       "\\begin{equation*} \\f{\\cosh}{\\alpha} = \\gamma \\end{equation*}\n",
       "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = \\left ( - \\beta  \\gamma  x' + 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t'\\right ) \\boldsymbol{\\gamma }_{t} + \\left ( - \\beta  \\gamma  t' + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{equation*}\n",
       "\\begin{equation*} \\bm{A} = A^{t}  \\boldsymbol{\\gamma }_{t} + A^{x}  \\boldsymbol{\\gamma }_{x} + A^{y}  \\boldsymbol{\\gamma }_{y} + A^{z}  \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\begin{equation*} \\bm{\\psi} = \\psi    + \\psi ^{tx}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} + \\psi ^{ty}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} + \\psi ^{tz}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} + \\psi ^{xy}  \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} + \\psi ^{xz}  \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} + \\psi ^{yz}  \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} + \\psi ^{txyz}  \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n",
       "\\end{document}\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "check_latex('print_check_latex')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A = z*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m - y*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + x*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "grad^A = 3*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "\n",
      "f = (x**2 + y**2 + z**2)**(-1.5)\n",
      "grad*f = -3.0*x*(x**2 + y**2 + z**2)**(-2.5)*\u001b[0;34me_x\u001b[0m - 3.0*y*(x**2 + y**2 + z**2)**(-2.5)*\u001b[0;34me_y\u001b[0m - 3.0*z*(x**2 + y**2 + z**2)**(-2.5)*\u001b[0;34me_z\u001b[0m\n",
      "\n",
      "B = z*(x**2 + y**2 + z**2)**(-1.5)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m - y*(x**2 + y**2 + z**2)**(-1.5)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + x*(x**2 + y**2 + z**2)**(-1.5)*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "\n",
      "grad^B = 0\n",
      "0\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "prob_not_solenoidal.py:5: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "prob_not_solenoidal.py:18: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  f = MV('f','scalar',fct=True)\n"
     ]
    }
   ],
   "source": [
    "run('prob_not_solenoidal')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "#3D Orthogonal Metric\\newline\n",
      "#Multvectors:\n",
      "s = s\n",
      "v = v__x*e_x + v__y*e_y + v__z*e_z\n",
      "b = b__xy*e_x^e_y + b__xz*e_x^e_z + b__yz*e_y^e_z\n",
      "#Products:\n",
      "\n",
      "s*s = s**2\n",
      "s^s = s**2\n",
      "s<s = s**2\n",
      "s>s = s**2\n",
      "s*v = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "s^v = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "s<v = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "s>v = 0\n",
      "s*b = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "s^b = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "s<b = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "s>b = 0\n",
      "\n",
      "v*s = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "v^s = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "v<s = 0\n",
      "v>s = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "v*v = v__x**2 + v__y**2 + v__z**2\n",
      "v^v = 0\n",
      "v|v = v__x**2 + v__y**2 + v__z**2\n",
      "v<v = v__x**2 + v__y**2 + v__z**2\n",
      "v>v = v__x**2 + v__y**2 + v__z**2\n",
      "v*b = (-b__xy*v__y - b__xz*v__z)*e_x + (b__xy*v__x - b__yz*v__z)*e_y + (b__xz*v__x + b__yz*v__y)*e_z + (b__xy*v__z - b__xz*v__y + b__yz*v__x)*e_x^e_y^e_z\n",
      "v^b = (b__xy*v__z - b__xz*v__y + b__yz*v__x)*e_x^e_y^e_z\n",
      "v|b = (-b__xy*v__y - b__xz*v__z)*e_x + (b__xy*v__x - b__yz*v__z)*e_y + (b__xz*v__x + b__yz*v__y)*e_z\n",
      "v<b = (-b__xy*v__y - b__xz*v__z)*e_x + (b__xy*v__x - b__yz*v__z)*e_y + (b__xz*v__x + b__yz*v__y)*e_z\n",
      "v>b = 0\n",
      "\n",
      "b*s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "b^s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "b<s = 0\n",
      "b>s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "b*v = (b__xy*v__y + b__xz*v__z)*e_x + (-b__xy*v__x + b__yz*v__z)*e_y + (-b__xz*v__x - b__yz*v__y)*e_z + (b__xy*v__z - b__xz*v__y + b__yz*v__x)*e_x^e_y^e_z\n",
      "b^v = (b__xy*v__z - b__xz*v__y + b__yz*v__x)*e_x^e_y^e_z\n",
      "b|v = (b__xy*v__y + b__xz*v__z)*e_x + (-b__xy*v__x + b__yz*v__z)*e_y + (-b__xz*v__x - b__yz*v__y)*e_z\n",
      "b<v = 0\n",
      "b>v = (b__xy*v__y + b__xz*v__z)*e_x + (-b__xy*v__x + b__yz*v__z)*e_y + (-b__xz*v__x - b__yz*v__y)*e_z\n",
      "b*b = -b__xy**2 - b__xz**2 - b__yz**2\n",
      "b^b = 0\n",
      "b|b = -b__xy**2 - b__xz**2 - b__yz**2\n",
      "b<b = -b__xy**2 - b__xz**2 - b__yz**2\n",
      "b>b = -b__xy**2 - b__xz**2 - b__yz**2\n",
      "#Multivector Functions:\n",
      "s(X) = s\n",
      "v(X) = v__x*e_x + v__y*e_y + v__z*e_z\n",
      "b(X) = b__xy*e_x^e_y + b__xz*e_x^e_z + b__yz*e_y^e_z\n",
      "#Products:\n",
      "\n",
      "grad*s = D{x}s*e_x + D{y}s*e_y + D{z}s*e_z\n",
      "grad^s = D{x}s*e_x + D{y}s*e_y + D{z}s*e_z\n",
      "grad<s = 0\n",
      "grad>s = D{x}s*e_x + D{y}s*e_y + D{z}s*e_z\n",
      "grad*v = D{x}v__x + D{y}v__y + D{z}v__z + (-D{y}v__x + D{x}v__y)*e_x^e_y + (-D{z}v__x + D{x}v__z)*e_x^e_z + (-D{z}v__y + D{y}v__z)*e_y^e_z\n",
      "grad^v = (-D{y}v__x + D{x}v__y)*e_x^e_y + (-D{z}v__x + D{x}v__z)*e_x^e_z + (-D{z}v__y + D{y}v__z)*e_y^e_z\n",
      "grad|v = D{x}v__x + D{y}v__y + D{z}v__z\n",
      "grad<v = D{x}v__x + D{y}v__y + D{z}v__z\n",
      "grad>v = D{x}v__x + D{y}v__y + D{z}v__z\n",
      "grad*b = (-D{y}b__xy - D{z}b__xz)*e_x + (D{x}b__xy - D{z}b__yz)*e_y + (D{x}b__xz + D{y}b__yz)*e_z + (D{z}b__xy - D{y}b__xz + D{x}b__yz)*e_x^e_y^e_z\n",
      "grad^b = (D{z}b__xy - D{y}b__xz + D{x}b__yz)*e_x^e_y^e_z\n",
      "grad|b = (-D{y}b__xy - D{z}b__xz)*e_x + (D{x}b__xy - D{z}b__yz)*e_y + (D{x}b__xz + D{y}b__yz)*e_z\n",
      "grad<b = (-D{y}b__xy - D{z}b__xz)*e_x + (D{x}b__xy - D{z}b__yz)*e_y + (D{x}b__xz + D{y}b__yz)*e_z\n",
      "grad>b = 0\n",
      "\n",
      "s*grad = e_x*s*D{x} + e_y*s*D{y} + e_z*s*D{z}\n",
      "s^grad = e_x*s*D{x} + e_y*s*D{y} + e_z*s*D{z}\n",
      "s<grad = e_x*s*D{x} + e_y*s*D{y} + e_z*s*D{z}\n",
      "s>grad =  0 \n",
      "s*s = s**2\n",
      "s^s = s**2\n",
      "s<s = s**2\n",
      "s>s = s**2\n",
      "s*v = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "s^v = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "s<v = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "s>v = 0\n",
      "s*b = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "s^b = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "s<b = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "s>b = 0\n",
      "\n",
      "v*grad = v__x*D{x} + v__y*D{y} + v__z*D{z} + e_x^e_y*(-v__y*D{x} + v__x*D{y}) + e_x^e_z*(-v__z*D{x} + v__x*D{z}) + e_y^e_z*(-v__z*D{y} + v__y*D{z})\n",
      "v^grad = e_x^e_y*(-v__y*D{x} + v__x*D{y}) + e_x^e_z*(-v__z*D{x} + v__x*D{z}) + e_y^e_z*(-v__z*D{y} + v__y*D{z})\n",
      "v|grad = v__x*D{x} + v__y*D{y} + v__z*D{z}\n",
      "v<grad = v__x*D{x} + v__y*D{y} + v__z*D{z}\n",
      "v>grad = v__x*D{x} + v__y*D{y} + v__z*D{z}\n",
      "v*s = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "v^s = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "v<s = 0\n",
      "v>s = s*v__x*e_x + s*v__y*e_y + s*v__z*e_z\n",
      "v*v = v__x**2 + v__y**2 + v__z**2\n",
      "v^v = 0\n",
      "v|v = v__x**2 + v__y**2 + v__z**2\n",
      "v<v = v__x**2 + v__y**2 + v__z**2\n",
      "v>v = v__x**2 + v__y**2 + v__z**2\n",
      "v*b = (-b__xy*v__y - b__xz*v__z)*e_x + (b__xy*v__x - b__yz*v__z)*e_y + (b__xz*v__x + b__yz*v__y)*e_z + (b__xy*v__z - b__xz*v__y + b__yz*v__x)*e_x^e_y^e_z\n",
      "v^b = (b__xy*v__z - b__xz*v__y + b__yz*v__x)*e_x^e_y^e_z\n",
      "v|b = (-b__xy*v__y - b__xz*v__z)*e_x + (b__xy*v__x - b__yz*v__z)*e_y + (b__xz*v__x + b__yz*v__y)*e_z\n",
      "v<b = (-b__xy*v__y - b__xz*v__z)*e_x + (b__xy*v__x - b__yz*v__z)*e_y + (b__xz*v__x + b__yz*v__y)*e_z\n",
      "v>b = 0\n",
      "\n",
      "b*grad = e_x*(b__xy*D{y} + b__xz*D{z}) + e_y*(-b__xy*D{x} + b__yz*D{z}) + e_z*(-b__xz*D{x} - b__yz*D{y}) + e_x^e_y^e_z*(b__yz*D{x} - b__xz*D{y} + b__xy*D{z})\n",
      "b^grad = e_x^e_y^e_z*(b__yz*D{x} - b__xz*D{y} + b__xy*D{z})\n",
      "b|grad = e_x*(b__xy*D{y} + b__xz*D{z}) + e_y*(-b__xy*D{x} + b__yz*D{z}) + e_z*(-b__xz*D{x} - b__yz*D{y})\n",
      "b<grad =  0 \n",
      "b>grad = e_x*(b__xy*D{y} + b__xz*D{z}) + e_y*(-b__xy*D{x} + b__yz*D{z}) + e_z*(-b__xz*D{x} - b__yz*D{y})\n",
      "b*s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "b^s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "b<s = 0\n",
      "b>s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n",
      "b*v = (b__xy*v__y + b__xz*v__z)*e_x + (-b__xy*v__x + b__yz*v__z)*e_y + (-b__xz*v__x - b__yz*v__y)*e_z + (b__xy*v__z - b__xz*v__y + b__yz*v__x)*e_x^e_y^e_z\n",
      "b^v = (b__xy*v__z - b__xz*v__y + b__yz*v__x)*e_x^e_y^e_z\n",
      "b|v = (b__xy*v__y + b__xz*v__z)*e_x + (-b__xy*v__x + b__yz*v__z)*e_y + (-b__xz*v__x - b__yz*v__y)*e_z\n",
      "b<v = 0\n",
      "b>v = (b__xy*v__y + b__xz*v__z)*e_x + (-b__xy*v__x + b__yz*v__z)*e_y + (-b__xz*v__x - b__yz*v__y)*e_z\n",
      "b*b = -b__xy**2 - b__xz**2 - b__yz**2\n",
      "b^b = 0\n",
      "b|b = -b__xy**2 - b__xz**2 - b__yz**2\n",
      "b<b = -b__xy**2 - b__xz**2 - b__yz**2\n",
      "b>b = -b__xy**2 - b__xz**2 - b__yz**2\n",
      "#General 2D Metric\\newline\n",
      "#Multivector Functions:\n",
      "s(X) = s\n",
      "v(X) = v__x*e_x + v__y*e_y\n",
      "b(X) = v__xy*e_x^e_y\n",
      "#Products:\n",
      "\n",
      "grad*s = (-(e_x.e_y)*D{y}s + (e_y.e_y)*D{x}s)*e_x/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2) + ((e_x.e_x)*D{y}s - (e_x.e_y)*D{x}s)*e_y/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)\n",
      "grad^s = (-(e_x.e_y)*D{y}s + (e_y.e_y)*D{x}s)*e_x/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2) + ((e_x.e_x)*D{y}s - (e_x.e_y)*D{x}s)*e_y/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)\n",
      "grad<s = 0\n",
      "grad>s = (-(e_x.e_y)*D{y}s + (e_y.e_y)*D{x}s)*e_x/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2) + ((e_x.e_x)*D{y}s - (e_x.e_y)*D{x}s)*e_y/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)\n",
      "grad*v = D{x}v__x + D{y}v__y + (-(e_x.e_x)*D{y}v__x + (e_x.e_y)*D{x}v__x - (e_x.e_y)*D{y}v__y + (e_y.e_y)*D{x}v__y)*e_x^e_y/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)\n",
      "grad^v = (-(e_x.e_x)*D{y}v__x + (e_x.e_y)*D{x}v__x - (e_x.e_y)*D{y}v__y + (e_y.e_y)*D{x}v__y)*e_x^e_y/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)\n",
      "grad|v = D{x}v__x + D{y}v__y\n",
      "grad<v = D{x}v__x + D{y}v__y\n",
      "grad>v = D{x}v__x + D{y}v__y\n",
      "\n",
      "s*grad = e_x*((e_y.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{x} - (e_x.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{y}) + e_y*(-(e_x.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{x} + (e_x.e_x)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{y})\n",
      "s^grad = e_x*((e_y.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{x} - (e_x.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{y}) + e_y*(-(e_x.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{x} + (e_x.e_x)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{y})\n",
      "s<grad = e_x*((e_y.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{x} - (e_x.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{y}) + e_y*(-(e_x.e_y)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{x} + (e_x.e_x)*s/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{y})\n",
      "s>grad =  0 \n",
      "s*s = s**2\n",
      "s^s = s**2\n",
      "s<s = s**2\n",
      "s>s = s**2\n",
      "s*v = s*v__x*e_x + s*v__y*e_y\n",
      "s^v = s*v__x*e_x + s*v__y*e_y\n",
      "s<v = s*v__x*e_x + s*v__y*e_y\n",
      "s>v = 0\n",
      "\n",
      "v*grad = v__x*D{x} + v__y*D{y} + e_x^e_y*(-((e_x.e_y)*v__x + (e_y.e_y)*v__y)/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{x} + ((e_x.e_x)*v__x + (e_x.e_y)*v__y)/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{y})\n",
      "v^grad = e_x^e_y*(-((e_x.e_y)*v__x + (e_y.e_y)*v__y)/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{x} + ((e_x.e_x)*v__x + (e_x.e_y)*v__y)/((e_x.e_x)*(e_y.e_y) - (e_x.e_y)**2)*D{y})\n",
      "v|grad = v__x*D{x} + v__y*D{y}\n",
      "v<grad = v__x*D{x} + v__y*D{y}\n",
      "v>grad = v__x*D{x} + v__y*D{y}\n",
      "v*s = s*v__x*e_x + s*v__y*e_y\n",
      "v^s = s*v__x*e_x + s*v__y*e_y\n",
      "v<s = 0\n",
      "v>s = s*v__x*e_x + s*v__y*e_y\n",
      "v*v = (e_x.e_x)*v__x**2 + 2*(e_x.e_y)*v__x*v__y + (e_y.e_y)*v__y**2\n",
      "v^v = 0\n",
      "v|v = (e_x.e_x)*v__x**2 + 2*(e_x.e_y)*v__x*v__y + (e_y.e_y)*v__y**2\n",
      "v<v = (e_x.e_x)*v__x**2 + 2*(e_x.e_y)*v__x*v__y + (e_y.e_y)*v__y**2\n",
      "v>v = (e_x.e_x)*v__x**2 + 2*(e_x.e_y)*v__x*v__y + (e_y.e_y)*v__y**2\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "products_latex.py:3: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "products_latex.py:13: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  s = MV('s','scalar')\n",
      "products_latex.py:14: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  v = MV('v','vector')\n",
      "products_latex.py:15: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  b = MV('b','bivector')\n",
      "products_latex.py:38: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  fs = MV('s','scalar',fct=True)\n",
      "products_latex.py:39: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  fv = MV('v','vector',fct=True)\n",
      "products_latex.py:40: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  fb = MV('b','bivector',fct=True)\n",
      "products_latex.py:71: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  s = MV('s','scalar',fct=True)\n",
      "products_latex.py:72: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  v = MV('v','vector',fct=True)\n",
      "products_latex.py:73: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  b = MV('v','bivector',fct=True)\n"
     ]
    }
   ],
   "source": [
    "run('products_latex')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "reflect_test.py:4: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "reflect_test.py:10: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  a = MV('a','vector')\n",
      "reflect_test.py:13: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  c = MV('c','vector')\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\\documentclass[10pt,fleqn]{report}\n",
       "\\usepackage[vcentering]{geometry}\n",
       "\\geometry{papersize={14in,11in},total={13in,10in}}\n",
       "\n",
       "\\pagestyle{empty}\n",
       "\\usepackage[latin1]{inputenc}\n",
       "\\usepackage{amsmath}\n",
       "\\usepackage{amsfonts}\n",
       "\\usepackage{amssymb}\n",
       "\\usepackage{amsbsy}\n",
       "\\usepackage{tensor}\n",
       "\\usepackage{listings}\n",
       "\\usepackage{color}\n",
       "\\usepackage{xcolor}\n",
       "\\usepackage{bm}\n",
       "\\usepackage{breqn}\n",
       "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n",
       "\\setlength{\\parindent}{0pt}\n",
       "\\DeclareMathOperator{\\Tr}{Tr}\n",
       "\\DeclareMathOperator{\\Adj}{Adj}\n",
       "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n",
       "\\newcommand{\\lp}{\\left (}\n",
       "\\newcommand{\\rp}{\\right )}\n",
       "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n",
       "\\newcommand{\\half}{\\frac{1}{2}}\n",
       "\\newcommand{\\llt}{\\left <}\n",
       "\\newcommand{\\rgt}{\\right >}\n",
       "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n",
       "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n",
       "\\newcommand{\\lbrc}{\\left \\{}\n",
       "\\newcommand{\\rbrc}{\\right \\}}\n",
       "\\newcommand{\\W}{\\wedge}\n",
       "\\newcommand{\\prm}[1]{{#1}'}\n",
       "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n",
       "\\newcommand{\\R}{\\dagger}\n",
       "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n",
       "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n",
       "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n",
       "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n",
       "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n",
       "\\newcommand{\\eb}{\\boldsymbol{e}}\n",
       "\\usepackage{float}\n",
       "\\floatstyle{plain} % optionally change the style of the new float\n",
       "\\newfloat{Code}{H}{myc}\n",
       "\\lstloadlanguages{Python}\n",
       "\n",
       "\\begin{document}\n",
       "\\begin{equation*} a = a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} b =  \\boldsymbol{e}_{x} + \\boldsymbol{e}_{y} + \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} c = c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} + c^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} a\\mbox{ reflect in }xy = a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} a\\mbox{ reflect in }yz = - a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} a\\mbox{ reflect in }zx = a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} a\\mbox{ reflect in plane }(x=y) = a^{y} \\boldsymbol{e}_{x} + a^{x} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} b\\mbox{ reflect in plane }(x+y+z=0) = - \\boldsymbol{e}_{x} - \\boldsymbol{e}_{y} - \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{x} = a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{y} = - a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{z} = - a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} c\\mbox{ reflect in }xy = - c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} - c^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} c\\mbox{ reflect in }xyz = - c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} + c^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} wx\\mbox{ reflect in }yz =  \\boldsymbol{e}_{w}\\wedge \\boldsymbol{e}_{x} \\end{equation*}\n",
       "\\begin{equation*} wx\\mbox{ reflect in }xy = - \\boldsymbol{e}_{w}\\wedge \\boldsymbol{e}_{x} \\end{equation*}\n",
       "\\end{document}\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "check_latex('reflect_test')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "simple_check_latex.py:3: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "simple_check_latex.py:10: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','mv')\n",
      "simple_check_latex.py:19: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  X = MV('X','vector')\n",
      "simple_check_latex.py:20: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  Y = MV('Y','vector')\n",
      "simple_check_latex.py:35: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  X = MV('X','vector')\n",
      "simple_check_latex.py:36: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','spinor')\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\\documentclass[10pt,fleqn]{report}\n",
       "\\usepackage[vcentering]{geometry}\n",
       "\\geometry{papersize={14in,11in},total={13in,10in}}\n",
       "\n",
       "\\pagestyle{empty}\n",
       "\\usepackage[latin1]{inputenc}\n",
       "\\usepackage{amsmath}\n",
       "\\usepackage{amsfonts}\n",
       "\\usepackage{amssymb}\n",
       "\\usepackage{amsbsy}\n",
       "\\usepackage{tensor}\n",
       "\\usepackage{listings}\n",
       "\\usepackage{color}\n",
       "\\usepackage{xcolor}\n",
       "\\usepackage{bm}\n",
       "\\usepackage{breqn}\n",
       "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n",
       "\\setlength{\\parindent}{0pt}\n",
       "\\DeclareMathOperator{\\Tr}{Tr}\n",
       "\\DeclareMathOperator{\\Adj}{Adj}\n",
       "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n",
       "\\newcommand{\\lp}{\\left (}\n",
       "\\newcommand{\\rp}{\\right )}\n",
       "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n",
       "\\newcommand{\\half}{\\frac{1}{2}}\n",
       "\\newcommand{\\llt}{\\left <}\n",
       "\\newcommand{\\rgt}{\\right >}\n",
       "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n",
       "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n",
       "\\newcommand{\\lbrc}{\\left \\{}\n",
       "\\newcommand{\\rbrc}{\\right \\}}\n",
       "\\newcommand{\\W}{\\wedge}\n",
       "\\newcommand{\\prm}[1]{{#1}'}\n",
       "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n",
       "\\newcommand{\\R}{\\dagger}\n",
       "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n",
       "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n",
       "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n",
       "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n",
       "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n",
       "\\newcommand{\\eb}{\\boldsymbol{e}}\n",
       "\\usepackage{float}\n",
       "\\floatstyle{plain} % optionally change the style of the new float\n",
       "\\newfloat{Code}{H}{myc}\n",
       "\\lstloadlanguages{Python}\n",
       "\n",
       "\\begin{document}\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{ccc}\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{x}\\right )  & \\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{y}\\right )  & \\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{z}\\right ) \\\\\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{y}\\right )  & \\left (\\boldsymbol{e}_{y}\\cdot \\boldsymbol{e}_{y}\\right )  & \\left (\\boldsymbol{e}_{y}\\cdot \\boldsymbol{e}_{z}\\right ) \\\\\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{z}\\right )  & \\left (\\boldsymbol{e}_{y}\\cdot \\boldsymbol{e}_{z}\\right )  & \\left (\\boldsymbol{e}_{z}\\cdot \\boldsymbol{e}_{z}\\right ) \\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} A = A  + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} A =  \\begin{aligned}[t]  & A  \\\\  &  + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\  &  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}  \\end{aligned} \\end{equation*}\n",
       "\\begin{equation*} A =  \\begin{aligned}[t]  & A  \\\\  &  + A^{x} \\boldsymbol{e}_{x} \\\\  &  + A^{y} \\boldsymbol{e}_{y} \\\\  &  + A^{z} \\boldsymbol{e}_{z} \\\\  &  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\  &  + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\  &  + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}  \\end{aligned} \\end{equation*}\n",
       "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\n",
       "\\begin{equation*} g_{ij} = \\left[\\begin{array}{cc}\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{x}\\right )  & \\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{y}\\right ) \\\\\\left (\\boldsymbol{e}_{x}\\cdot \\boldsymbol{e}_{y}\\right )  & \\left (\\boldsymbol{e}_{y}\\cdot \\boldsymbol{e}_{y}\\right ) \\end{array}\\right] \\end{equation*}\n",
       "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n",
       "\\begin{equation*} A = A  + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n",
       "\\end{document}\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "check_latex('simple_check_latex')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "u__x\u001b[0m*\u001b[0;34me_x\u001b[0m + u__y\u001b[0m*\u001b[0;34me_y\u001b[0m + u__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "v__x\u001b[0m*\u001b[0;34me_x\u001b[0m + v__y\u001b[0m*\u001b[0;34me_y\u001b[0m + v__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "w__x\u001b[0m*\u001b[0;34me_x\u001b[0m + w__y\u001b[0m*\u001b[0;34me_y\u001b[0m + w__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "(u__x\u001b[0m*v__y\u001b[0m - u__y\u001b[0m*v__x\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + (u__x\u001b[0m*v__z\u001b[0m - u__z\u001b[0m*v__x\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + (u__y\u001b[0m*v__z\u001b[0m - u__z\u001b[0m*v__y\u001b[0m)*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "True\n",
      "(u__x\u001b[0m*v__y\u001b[0m*w__z\u001b[0m - u__x\u001b[0m*v__z\u001b[0m*w__y\u001b[0m - u__y\u001b[0m*v__x\u001b[0m*w__z\u001b[0m + u__y\u001b[0m*v__z\u001b[0m*w__x\u001b[0m + u__z\u001b[0m*v__x\u001b[0m*w__y\u001b[0m - u__z\u001b[0m*v__y\u001b[0m*w__x\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "True\n",
      "-u__x\u001b[0m**2*v__y\u001b[0m**2 - u__x\u001b[0m**2*v__z\u001b[0m**2 + 2*u__x\u001b[0m*u__y\u001b[0m*v__x\u001b[0m*v__y\u001b[0m + 2*u__x\u001b[0m*u__z\u001b[0m*v__x\u001b[0m*v__z\u001b[0m - u__y\u001b[0m**2*v__x\u001b[0m**2 - u__y\u001b[0m**2*v__z\u001b[0m**2 + 2*u__y\u001b[0m*u__z\u001b[0m*v__y\u001b[0m*v__z\u001b[0m - u__z\u001b[0m**2*v__x\u001b[0m**2 - u__z\u001b[0m**2*v__y\u001b[0m**2\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "simple_check.py:5: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "simple_check.py:13: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  u = MV('u','vector')\n",
      "simple_check.py:14: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  v = MV('v','vector')\n",
      "simple_check.py:15: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  w = MV('w','vector')\n"
     ]
    }
   ],
   "source": [
    "run('simple_check')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "spherical_latex.py:5: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "spherical_latex.py:14: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  f = MV('f','scalar',fct=True)\n",
      "spherical_latex.py:15: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n",
      "spherical_latex.py:16: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','grade2',fct=True)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\\documentclass[10pt,fleqn]{report}\n",
       "\\usepackage[vcentering]{geometry}\n",
       "\\geometry{papersize={14in,11in},total={13in,10in}}\n",
       "\n",
       "\\pagestyle{empty}\n",
       "\\usepackage[latin1]{inputenc}\n",
       "\\usepackage{amsmath}\n",
       "\\usepackage{amsfonts}\n",
       "\\usepackage{amssymb}\n",
       "\\usepackage{amsbsy}\n",
       "\\usepackage{tensor}\n",
       "\\usepackage{listings}\n",
       "\\usepackage{color}\n",
       "\\usepackage{xcolor}\n",
       "\\usepackage{bm}\n",
       "\\usepackage{breqn}\n",
       "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n",
       "\\setlength{\\parindent}{0pt}\n",
       "\\DeclareMathOperator{\\Tr}{Tr}\n",
       "\\DeclareMathOperator{\\Adj}{Adj}\n",
       "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n",
       "\\newcommand{\\lp}{\\left (}\n",
       "\\newcommand{\\rp}{\\right )}\n",
       "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n",
       "\\newcommand{\\half}{\\frac{1}{2}}\n",
       "\\newcommand{\\llt}{\\left <}\n",
       "\\newcommand{\\rgt}{\\right >}\n",
       "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n",
       "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n",
       "\\newcommand{\\lbrc}{\\left \\{}\n",
       "\\newcommand{\\rbrc}{\\right \\}}\n",
       "\\newcommand{\\W}{\\wedge}\n",
       "\\newcommand{\\prm}[1]{{#1}'}\n",
       "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n",
       "\\newcommand{\\R}{\\dagger}\n",
       "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n",
       "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n",
       "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n",
       "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n",
       "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n",
       "\\newcommand{\\eb}{\\boldsymbol{e}}\n",
       "\\usepackage{float}\n",
       "\\floatstyle{plain} % optionally change the style of the new float\n",
       "\\newfloat{Code}{H}{myc}\n",
       "\\lstloadlanguages{Python}\n",
       "\n",
       "\\begin{document}\n",
       "\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n",
       "def derivatives_in_spherical_coordinates():\n",
       "    Print_Function()\n",
       "    X = (r,th,phi) = symbols('r theta phi')\n",
       "    curv = [[r*cos(phi)*sin(th),r*sin(phi)*sin(th),r*cos(th)],[1,r,r*sin(th)]]\n",
       "    (er,eth,ephi,grad) = MV.setup('e_r e_theta e_phi',metric='[1,1,1]',coords=X,curv=curv)\n",
       "    f = MV('f','scalar',fct=True)\n",
       "    A = MV('A','vector',fct=True)\n",
       "    B = MV('B','grade2',fct=True)\n",
       "    print('f =',f)\n",
       "    print('A =',A)\n",
       "    print('B =',B)\n",
       "    print('grad*f =',grad*f)\n",
       "    print('grad|A =',grad|A)\n",
       "    print('-I*(grad^A) =',-MV.I*(grad^A))\n",
       "    print('grad^B =',grad^B)\n",
       "    return\n",
       "\\end{lstlisting}\n",
       "Code Output:\n",
       "\\begin{equation*} f = f \\end{equation*}\n",
       "\\begin{equation*} A = A^{r}  \\boldsymbol{e}_{r} + A^{\\theta }  \\boldsymbol{e}_{\\theta } + A^{\\phi }  \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} B = B^{r\\theta }  \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi }  \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi }  \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla}  f = \\partial_{r} f  \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta  \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta  \\right )}} + \\partial_{\\phi } A^{\\phi }  + \\partial_{r} A^{r}  + \\partial_{\\theta } A^{\\theta }  + \\frac{2 A^{r} }{r} \\end{equation*}\n",
       "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta  \\right )}} + \\partial_{\\theta } A^{\\phi }  - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta  \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta  \\right )}}^{2} \\partial_{r} A^{\\phi }  - 2 r A^{\\phi }  {\\sin{\\left (\\theta  \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta }  + 2 r A^{\\theta }  - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta  \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi }  + 4 r B^{\\theta \\phi }  - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta  \\right )}} - \\partial_{\\theta } B^{r\\phi }  + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta  \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n",
       "\\end{document}\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "check_latex('spherical_latex')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A = A + A__x\u001b[0m*\u001b[0;34me_x\u001b[0m + A__y\u001b[0m*\u001b[0;34me_y\u001b[0m + A__z\u001b[0m*\u001b[0;34me_z\u001b[0m + A__x\u001b[0my\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + A__x\u001b[0mz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + A__y\u001b[0mz\u001b[0m*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m + A__x\u001b[0my\u001b[0mz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "A =  A\n",
      " + A__x\u001b[0m*\u001b[0;34me_x\u001b[0m + A__y\u001b[0m*\u001b[0;34me_y\u001b[0m + A__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      " + A__x\u001b[0my\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + A__x\u001b[0mz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + A__y\u001b[0mz\u001b[0m*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      " + A__x\u001b[0my\u001b[0mz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "A =  A\n",
      " + A__x\u001b[0m*\u001b[0;34me_x\u001b[0m\n",
      " + A__y\u001b[0m*\u001b[0;34me_y\u001b[0m\n",
      " + A__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      " + A__x\u001b[0my\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m\n",
      " + A__x\u001b[0mz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      " + A__y\u001b[0mz\u001b[0m*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      " + A__x\u001b[0my\u001b[0mz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "g_{ij} =\n",
      " Matrix([\n",
      "[(\u001b[0;34me_x\u001b[0m.\u001b[0;34me_x\u001b[0m), (\u001b[0;34me_x\u001b[0m.\u001b[0;34me_y\u001b[0m), (\u001b[0;34me_x\u001b[0m.\u001b[0;34me_z\u001b[0m)],\n",
      "[(\u001b[0;34me_x\u001b[0m.\u001b[0;34me_y\u001b[0m), (\u001b[0;34me_y\u001b[0m.\u001b[0;34me_y\u001b[0m), (\u001b[0;34me_y\u001b[0m.\u001b[0;34me_z\u001b[0m)],\n",
      "[(\u001b[0;34me_x\u001b[0m.\u001b[0;34me_z\u001b[0m), (\u001b[0;34me_y\u001b[0m.\u001b[0;34me_z\u001b[0m), (\u001b[0;34me_z\u001b[0m.\u001b[0;34me_z\u001b[0m)]])\n",
      "X = X__x\u001b[0m*\u001b[0;34me_x\u001b[0m + X__y\u001b[0m*\u001b[0;34me_y\u001b[0m + X__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "Y = Y__x\u001b[0m*\u001b[0;34me_x\u001b[0m + Y__y\u001b[0m*\u001b[0;34me_y\u001b[0m + Y__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "g_{ij} =\n",
      " Matrix([\n",
      "[(\u001b[0;34me_x\u001b[0m.\u001b[0;34me_x\u001b[0m), (\u001b[0;34me_x\u001b[0m.\u001b[0;34me_y\u001b[0m)],\n",
      "[(\u001b[0;34me_x\u001b[0m.\u001b[0;34me_y\u001b[0m), (\u001b[0;34me_y\u001b[0m.\u001b[0;34me_y\u001b[0m)]])\n",
      "X = X__x\u001b[0m*\u001b[0;34me_x\u001b[0m + X__y\u001b[0m*\u001b[0;34me_y\u001b[0m\n",
      "A = A + A__x\u001b[0my\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m\n",
      "g_{ii} =\n",
      " Matrix([\n",
      "[1, 0],\n",
      "[0, 1]])\n",
      "X = X__x\u001b[0m*\u001b[0;34me_x\u001b[0m + X__y\u001b[0m*\u001b[0;34me_y\u001b[0m\n",
      "A = A + A__x\u001b[0my\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m\n",
      "g_{ij} =\n",
      " Matrix([\n",
      "[(\u001b[0;34ma\u001b[0m.\u001b[0;34ma\u001b[0m), (\u001b[0;34ma\u001b[0m.\u001b[0;34mb\u001b[0m), (\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m), (\u001b[0;34ma\u001b[0m.\u001b[0;34md\u001b[0m), (\u001b[0;34ma\u001b[0m.\u001b[0;34me\u001b[0m)],\n",
      "[(\u001b[0;34ma\u001b[0m.\u001b[0;34mb\u001b[0m), (\u001b[0;34mb\u001b[0m.\u001b[0;34mb\u001b[0m), (\u001b[0;34mb\u001b[0m.\u001b[0;34mc\u001b[0m), (\u001b[0;34mb\u001b[0m.\u001b[0;34md\u001b[0m), (\u001b[0;34mb\u001b[0m.\u001b[0;34me\u001b[0m)],\n",
      "[(\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m), (\u001b[0;34mb\u001b[0m.\u001b[0;34mc\u001b[0m), (\u001b[0;34mc\u001b[0m.\u001b[0;34mc\u001b[0m), (\u001b[0;34mc\u001b[0m.\u001b[0;34md\u001b[0m), (\u001b[0;34mc\u001b[0m.\u001b[0;34me\u001b[0m)],\n",
      "[(\u001b[0;34ma\u001b[0m.\u001b[0;34md\u001b[0m), (\u001b[0;34mb\u001b[0m.\u001b[0;34md\u001b[0m), (\u001b[0;34mc\u001b[0m.\u001b[0;34md\u001b[0m), (\u001b[0;34md\u001b[0m.\u001b[0;34md\u001b[0m), (\u001b[0;34md\u001b[0m.\u001b[0;34me\u001b[0m)],\n",
      "[(\u001b[0;34ma\u001b[0m.\u001b[0;34me\u001b[0m), (\u001b[0;34mb\u001b[0m.\u001b[0;34me\u001b[0m), (\u001b[0;34mc\u001b[0m.\u001b[0;34me\u001b[0m), (\u001b[0;34md\u001b[0m.\u001b[0;34me\u001b[0m), (\u001b[0;34me\u001b[0m.\u001b[0;34me\u001b[0m)]])\n",
      "a|(b*c) = -(\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m)*\u001b[0;34mb\u001b[0m + (\u001b[0;34ma\u001b[0m.\u001b[0;34mb\u001b[0m)*\u001b[0;34mc\u001b[0m\n",
      "a|(b^c) = -(\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m)*\u001b[0;34mb\u001b[0m + (\u001b[0;34ma\u001b[0m.\u001b[0;34mb\u001b[0m)*\u001b[0;34mc\u001b[0m\n",
      "a|(b^c^d) = (\u001b[0;34ma\u001b[0m.\u001b[0;34md\u001b[0m)*\u001b[0;34mb\u001b[0m^\u001b[0;34mc\u001b[0m - (\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m)*\u001b[0;34mb\u001b[0m^\u001b[0;34md\u001b[0m + (\u001b[0;34ma\u001b[0m.\u001b[0;34mb\u001b[0m)*\u001b[0;34mc\u001b[0m^\u001b[0;34md\u001b[0m\n",
      "a|(b^c)+c|(a^b)+b|(c^a) = 0\n",
      "a*(b^c)-b*(a^c)+c*(a^b) = 3*\u001b[0;34ma\u001b[0m^\u001b[0;34mb\u001b[0m^\u001b[0;34mc\u001b[0m\n",
      "a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c) = 4*\u001b[0;34ma\u001b[0m^\u001b[0;34mb\u001b[0m^\u001b[0;34mc\u001b[0m^\u001b[0;34md\u001b[0m\n",
      "(a^b)|(c^d) = -(\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m)*(\u001b[0;34mb\u001b[0m.\u001b[0;34md\u001b[0m) + (\u001b[0;34ma\u001b[0m.\u001b[0;34md\u001b[0m)*(\u001b[0;34mb\u001b[0m.\u001b[0;34mc\u001b[0m)\n",
      "((a^b)|c)|d = -(\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m)*(\u001b[0;34mb\u001b[0m.\u001b[0;34md\u001b[0m) + (\u001b[0;34ma\u001b[0m.\u001b[0;34md\u001b[0m)*(\u001b[0;34mb\u001b[0m.\u001b[0;34mc\u001b[0m)\n",
      "(a^b)x(c^d) = -(\u001b[0;34mb\u001b[0m.\u001b[0;34md\u001b[0m)*\u001b[0;34ma\u001b[0m^\u001b[0;34mc\u001b[0m + (\u001b[0;34mb\u001b[0m.\u001b[0;34mc\u001b[0m)*\u001b[0;34ma\u001b[0m^\u001b[0;34md\u001b[0m + (\u001b[0;34ma\u001b[0m.\u001b[0;34md\u001b[0m)*\u001b[0;34mb\u001b[0m^\u001b[0;34mc\u001b[0m - (\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m)*\u001b[0;34mb\u001b[0m^\u001b[0;34md\u001b[0m\n",
      "(a|(b^c))|(d^e) = (-(\u001b[0;34ma\u001b[0m.\u001b[0;34mb\u001b[0m)*(\u001b[0;34mc\u001b[0m.\u001b[0;34me\u001b[0m) + (\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m)*(\u001b[0;34mb\u001b[0m.\u001b[0;34me\u001b[0m))*\u001b[0;34md\u001b[0m + ((\u001b[0;34ma\u001b[0m.\u001b[0;34mb\u001b[0m)*(\u001b[0;34mc\u001b[0m.\u001b[0;34md\u001b[0m) - (\u001b[0;34ma\u001b[0m.\u001b[0;34mc\u001b[0m)*(\u001b[0;34mb\u001b[0m.\u001b[0;34md\u001b[0m))*\u001b[0;34me\u001b[0m\n",
      "f = \u001b[0;31mf\u001b[0m\n",
      "A = \u001b[0;31mA__x\u001b[0m*\u001b[0;34me_x\u001b[0m + \u001b[0;31mA__y\u001b[0m*\u001b[0;34me_y\u001b[0m + \u001b[0;31mA__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "B = \u001b[0;31mB__xy\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + \u001b[0;31mB__xz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + \u001b[0;31mB__yz\u001b[0m*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "C = \u001b[0;31mC\u001b[0m + \u001b[0;31mC__x\u001b[0m*\u001b[0;34me_x\u001b[0m + \u001b[0;31mC__y\u001b[0m*\u001b[0;34me_y\u001b[0m + \u001b[0;31mC__z\u001b[0m*\u001b[0;34me_z\u001b[0m + \u001b[0;31mC__xy\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + \u001b[0;31mC__xz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + \u001b[0;31mC__yz\u001b[0m*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m + \u001b[0;31mC__xyz\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "grad*f = \u001b[0;36mD{x}\u001b[0;31mf\u001b[0m\u001b[0m*\u001b[0;34me_x\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mf\u001b[0m\u001b[0m*\u001b[0;34me_y\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mf\u001b[0m\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "grad|A = \u001b[0;36mD{x}\u001b[0;31mA__x\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mA__y\u001b[0m\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mA__z\u001b[0m\u001b[0m\n",
      "grad*A = \u001b[0;36mD{x}\u001b[0;31mA__x\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mA__y\u001b[0m\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mA__z\u001b[0m\u001b[0m + (-\u001b[0;36mD{y}\u001b[0;31mA__x\u001b[0m\u001b[0m + \u001b[0;36mD{x}\u001b[0;31mA__y\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + (-\u001b[0;36mD{z}\u001b[0;31mA__x\u001b[0m\u001b[0m + \u001b[0;36mD{x}\u001b[0;31mA__z\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + (-\u001b[0;36mD{z}\u001b[0;31mA__y\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mA__z\u001b[0m\u001b[0m)*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "-I*(grad^A) = (-\u001b[0;36mD{z}\u001b[0;31mA__y\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mA__z\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m + (\u001b[0;36mD{z}\u001b[0;31mA__x\u001b[0m\u001b[0m - \u001b[0;36mD{x}\u001b[0;31mA__z\u001b[0m\u001b[0m)*\u001b[0;34me_y\u001b[0m + (-\u001b[0;36mD{y}\u001b[0;31mA__x\u001b[0m\u001b[0m + \u001b[0;36mD{x}\u001b[0;31mA__y\u001b[0m\u001b[0m)*\u001b[0;34me_z\u001b[0m\n",
      "grad*B = (-\u001b[0;36mD{y}\u001b[0;31mB__xy\u001b[0m\u001b[0m - \u001b[0;36mD{z}\u001b[0;31mB__xz\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m + (\u001b[0;36mD{x}\u001b[0;31mB__xy\u001b[0m\u001b[0m - \u001b[0;36mD{z}\u001b[0;31mB__yz\u001b[0m\u001b[0m)*\u001b[0;34me_y\u001b[0m + (\u001b[0;36mD{x}\u001b[0;31mB__xz\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mB__yz\u001b[0m\u001b[0m)*\u001b[0;34me_z\u001b[0m + (\u001b[0;36mD{z}\u001b[0;31mB__xy\u001b[0m\u001b[0m - \u001b[0;36mD{y}\u001b[0;31mB__xz\u001b[0m\u001b[0m + \u001b[0;36mD{x}\u001b[0;31mB__yz\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "grad^B = (\u001b[0;36mD{z}\u001b[0;31mB__xy\u001b[0m\u001b[0m - \u001b[0;36mD{y}\u001b[0;31mB__xz\u001b[0m\u001b[0m + \u001b[0;36mD{x}\u001b[0;31mB__yz\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "grad|B = (-\u001b[0;36mD{y}\u001b[0;31mB__xy\u001b[0m\u001b[0m - \u001b[0;36mD{z}\u001b[0;31mB__xz\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m + (\u001b[0;36mD{x}\u001b[0;31mB__xy\u001b[0m\u001b[0m - \u001b[0;36mD{z}\u001b[0;31mB__yz\u001b[0m\u001b[0m)*\u001b[0;34me_y\u001b[0m + (\u001b[0;36mD{x}\u001b[0;31mB__xz\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mB__yz\u001b[0m\u001b[0m)*\u001b[0;34me_z\u001b[0m\n",
      "grad<A = \u001b[0;36mD{x}\u001b[0;31mA__x\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mA__y\u001b[0m\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mA__z\u001b[0m\u001b[0m\n",
      "grad>A = \u001b[0;36mD{x}\u001b[0;31mA__x\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mA__y\u001b[0m\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mA__z\u001b[0m\u001b[0m\n",
      "grad<B = (-\u001b[0;36mD{y}\u001b[0;31mB__xy\u001b[0m\u001b[0m - \u001b[0;36mD{z}\u001b[0;31mB__xz\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m + (\u001b[0;36mD{x}\u001b[0;31mB__xy\u001b[0m\u001b[0m - \u001b[0;36mD{z}\u001b[0;31mB__yz\u001b[0m\u001b[0m)*\u001b[0;34me_y\u001b[0m + (\u001b[0;36mD{x}\u001b[0;31mB__xz\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mB__yz\u001b[0m\u001b[0m)*\u001b[0;34me_z\u001b[0m\n",
      "grad>B = 0\n",
      "grad<C = \u001b[0;36mD{x}\u001b[0;31mC__x\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mC__y\u001b[0m\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mC__z\u001b[0m\u001b[0m + (-\u001b[0;36mD{y}\u001b[0;31mC__xy\u001b[0m\u001b[0m - \u001b[0;36mD{z}\u001b[0;31mC__xz\u001b[0m\u001b[0m)*\u001b[0;34me_x\u001b[0m + (\u001b[0;36mD{x}\u001b[0;31mC__xy\u001b[0m\u001b[0m - \u001b[0;36mD{z}\u001b[0;31mC__yz\u001b[0m\u001b[0m)*\u001b[0;34me_y\u001b[0m + (\u001b[0;36mD{x}\u001b[0;31mC__xz\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mC__yz\u001b[0m\u001b[0m)*\u001b[0;34me_z\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mC__xyz\u001b[0m\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m - \u001b[0;36mD{y}\u001b[0;31mC__xyz\u001b[0m\u001b[0m*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + \u001b[0;36mD{x}\u001b[0;31mC__xyz\u001b[0m\u001b[0m*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "grad>C = \u001b[0;36mD{x}\u001b[0;31mC__x\u001b[0m\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mC__y\u001b[0m\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mC__z\u001b[0m\u001b[0m + \u001b[0;36mD{x}\u001b[0;31mC\u001b[0m\u001b[0m*\u001b[0;34me_x\u001b[0m + \u001b[0;36mD{y}\u001b[0;31mC\u001b[0m\u001b[0m*\u001b[0;34me_y\u001b[0m + \u001b[0;36mD{z}\u001b[0;31mC\u001b[0m\u001b[0m*\u001b[0;34me_z\u001b[0m\n",
      "f = \u001b[0;31mf\u001b[0m\n",
      "A = \u001b[0;31mA__r\u001b[0m*\u001b[0;34me_r\u001b[0m + \u001b[0;31mA__theta\u001b[0m*\u001b[0;34me_theta\u001b[0m + \u001b[0;31mA__phi\u001b[0m*\u001b[0;34me_phi\u001b[0m\n",
      "B = \u001b[0;31mB__rtheta\u001b[0m*\u001b[0;34me_r\u001b[0m^\u001b[0;34me_theta\u001b[0m + \u001b[0;31mB__rphi\u001b[0m*\u001b[0;34me_r\u001b[0m^\u001b[0;34me_phi\u001b[0m + \u001b[0;31mB__thetaphi\u001b[0m*\u001b[0;34me_theta\u001b[0m^\u001b[0;34me_phi\u001b[0m\n",
      "grad*f = \u001b[0;36mD{r}\u001b[0;31mf\u001b[0m\u001b[0m*\u001b[0;34me_r\u001b[0m + \u001b[0;36mD{theta}\u001b[0;31mf\u001b[0m\u001b[0m*\u001b[0;34me_theta\u001b[0m/r**2 + \u001b[0;36mD{phi}\u001b[0;31mf\u001b[0m\u001b[0m*\u001b[0;34me_phi\u001b[0m/(r**2*sin(theta)**2)\n",
      "grad|A = \u001b[0;31mA__theta\u001b[0m/tan(theta) + \u001b[0;36mD{phi}\u001b[0;31mA__phi\u001b[0m\u001b[0m + \u001b[0;36mD{r}\u001b[0;31mA__r\u001b[0m\u001b[0m + \u001b[0;36mD{theta}\u001b[0;31mA__theta\u001b[0m\u001b[0m + 2*\u001b[0;31mA__r\u001b[0m/r\n",
      "-I*(grad^A) = sqrt(r**4*sin(theta)**2)*(2*\u001b[0;31mA__phi\u001b[0m/tan(theta) + \u001b[0;36mD{theta}\u001b[0;31mA__phi\u001b[0m\u001b[0m - \u001b[0;36mD{phi}\u001b[0;31mA__theta\u001b[0m\u001b[0m/sin(theta)**2)*\u001b[0;34me_r\u001b[0m/r**2 + (-r**2*sin(theta)**2*\u001b[0;36mD{r}\u001b[0;31mA__phi\u001b[0m\u001b[0m - 2*r*\u001b[0;31mA__phi\u001b[0m*sin(theta)**2 + \u001b[0;36mD{phi}\u001b[0;31mA__r\u001b[0m\u001b[0m)*\u001b[0;34me_theta\u001b[0m/sqrt(r**4*sin(theta)**2) + (r**2*\u001b[0;36mD{r}\u001b[0;31mA__theta\u001b[0m\u001b[0m + 2*r*\u001b[0;31mA__theta\u001b[0m - \u001b[0;36mD{theta}\u001b[0;31mA__r\u001b[0m\u001b[0m)*\u001b[0;34me_phi\u001b[0m/sqrt(r**4*sin(theta)**2)\n",
      "grad^B = (r**2*\u001b[0;36mD{r}\u001b[0;31mB__thetaphi\u001b[0m\u001b[0m + 4*r*\u001b[0;31mB__thetaphi\u001b[0m - 2*\u001b[0;31mB__rphi\u001b[0m/tan(theta) - \u001b[0;36mD{theta}\u001b[0;31mB__rphi\u001b[0m\u001b[0m + \u001b[0;36mD{phi}\u001b[0;31mB__rtheta\u001b[0m\u001b[0m/sin(theta)**2)*\u001b[0;34me_r\u001b[0m^\u001b[0;34me_theta\u001b[0m^\u001b[0;34me_phi\u001b[0m/r**2\n",
      "X = 1.2*\u001b[0;34me_x\u001b[0m + 2.34*\u001b[0;34me_y\u001b[0m + 0.555*\u001b[0;34me_z\u001b[0m\n",
      "Nga(X,2) = 1.2*\u001b[0;34me_x\u001b[0m + 2.3*\u001b[0;34me_y\u001b[0m + 0.55*\u001b[0;34me_z\u001b[0m\n",
      "X*Y = 12.7011 + 4.02078*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + 6.175185*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + 10.182*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "Nga(X*Y,2) = 13.0 + 4.0*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_y\u001b[0m + 6.2*\u001b[0;34me_x\u001b[0m^\u001b[0;34me_z\u001b[0m + 10.0*\u001b[0;34me_y\u001b[0m^\u001b[0;34me_z\u001b[0m\n",
      "g_{ij} =\n",
      " Matrix([\n",
      "[1, 0, 0, 0, 0],\n",
      "[0, 1, 0, 0, 0],\n",
      "[0, 0, 1, 0, 0],\n",
      "[0, 0, 0, 0, 2],\n",
      "[0, 0, 0, 2, 0]])\n",
      "F(a) = \u001b[0;34me_1\u001b[0m + \u001b[0;34mn\u001b[0m/2 - \u001b[0;34mnbar\u001b[0m/2\n",
      "F(b) = \u001b[0;34me_2\u001b[0m + \u001b[0;34mn\u001b[0m/2 - \u001b[0;34mnbar\u001b[0m/2\n",
      "F(c) = -\u001b[0;34me_1\u001b[0m + \u001b[0;34mn\u001b[0m/2 - \u001b[0;34mnbar\u001b[0m/2\n",
      "F(d) = \u001b[0;34me_3\u001b[0m + \u001b[0;34mn\u001b[0m/2 - \u001b[0;34mnbar\u001b[0m/2\n",
      "F(x) = x1*\u001b[0;34me_1\u001b[0m + x2*\u001b[0;34me_2\u001b[0m + x3*\u001b[0;34me_3\u001b[0m + (x1**2/2 + x2**2/2 + x3**2/2)*\u001b[0;34mn\u001b[0m - \u001b[0;34mnbar\u001b[0m/2\n",
      "a = e1, b = e2, c = -e1, and d = e3\n",
      "A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.\n",
      "Circle through a, b, and c\n",
      "Circle: A^B^C^X = 0 = -x3*\u001b[0;34me_1\u001b[0m^\u001b[0;34me_2\u001b[0m^\u001b[0;34me_3\u001b[0m^\u001b[0;34mn\u001b[0m + x3*\u001b[0;34me_1\u001b[0m^\u001b[0;34me_2\u001b[0m^\u001b[0;34me_3\u001b[0m^\u001b[0;34mnbar\u001b[0m + (x1**2/2 + x2**2/2 + x3**2/2 - 1/2)*\u001b[0;34me_1\u001b[0m^\u001b[0;34me_2\u001b[0m^\u001b[0;34mn\u001b[0m^\u001b[0;34mnbar\u001b[0m\n",
      "Line through a and b\n",
      "Line  : A^B^n^X = 0 = -x3*\u001b[0;34me_1\u001b[0m^\u001b[0;34me_2\u001b[0m^\u001b[0;34me_3\u001b[0m^\u001b[0;34mn\u001b[0m + (x1/2 + x2/2 - 1/2)*\u001b[0;34me_1\u001b[0m^\u001b[0;34me_2\u001b[0m^\u001b[0;34mn\u001b[0m^\u001b[0;34mnbar\u001b[0m + x3*\u001b[0;34me_1\u001b[0m^\u001b[0;34me_3\u001b[0m^\u001b[0;34mn\u001b[0m^\u001b[0;34mnbar\u001b[0m/2 - x3*\u001b[0;34me_2\u001b[0m^\u001b[0;34me_3\u001b[0m^\u001b[0;34mn\u001b[0m^\u001b[0;34mnbar\u001b[0m/2\n",
      "Sphere through a, b, c, and d\n",
      "Sphere: A^B^C^D^X = 0 = (-x1**2/2 - x2**2/2 - x3**2/2 + 1/2)*\u001b[0;34me_1\u001b[0m^\u001b[0;34me_2\u001b[0m^\u001b[0;34me_3\u001b[0m^\u001b[0;34mn\u001b[0m^\u001b[0;34mnbar\u001b[0m\n",
      "Plane through a, b, and d\n",
      "Plane : A^B^n^D^X = 0 = (-x1/2 - x2/2 - x3/2 + 1/2)*\u001b[0;34me_1\u001b[0m^\u001b[0;34me_2\u001b[0m^\u001b[0;34me_3\u001b[0m^\u001b[0;34mn\u001b[0m^\u001b[0;34mnbar\u001b[0m\n",
      "g_{ij} =\n",
      " Matrix([\n",
      "[(\u001b[0;34mp1\u001b[0m.\u001b[0;34mp1\u001b[0m), (\u001b[0;34mp1\u001b[0m.\u001b[0;34mp2\u001b[0m), (\u001b[0;34mp1\u001b[0m.\u001b[0;34mp3\u001b[0m), 0, 0],\n",
      "[(\u001b[0;34mp1\u001b[0m.\u001b[0;34mp2\u001b[0m), (\u001b[0;34mp2\u001b[0m.\u001b[0;34mp2\u001b[0m), (\u001b[0;34mp2\u001b[0m.\u001b[0;34mp3\u001b[0m), 0, 0],\n",
      "[(\u001b[0;34mp1\u001b[0m.\u001b[0;34mp3\u001b[0m), (\u001b[0;34mp2\u001b[0m.\u001b[0;34mp3\u001b[0m), (\u001b[0;34mp3\u001b[0m.\u001b[0;34mp3\u001b[0m), 0, 0],\n",
      "[                            0,                             0,                             0, 0, 2],\n",
      "[                            0,                             0,                             0, 2, 0]])\n",
      "Extracting direction of line from L = P1^P2^n\n",
      "(L|n)|nbar = 2*\u001b[0;34mp1\u001b[0m - 2*\u001b[0;34mp2\u001b[0m\n",
      "Extracting plane of circle from C = P1^P2^P3\n",
      "((C^n)|n)|nbar = 2*\u001b[0;34mp1\u001b[0m^\u001b[0;34mp2\u001b[0m - 2*\u001b[0;34mp1\u001b[0m^\u001b[0;34mp3\u001b[0m + 2*\u001b[0;34mp2\u001b[0m^\u001b[0;34mp3\u001b[0m\n",
      "(p2-p1)^(p3-p1) = \u001b[0;34mp1\u001b[0m^\u001b[0;34mp2\u001b[0m - \u001b[0;34mp1\u001b[0m^\u001b[0;34mp3\u001b[0m + \u001b[0;34mp2\u001b[0m^\u001b[0;34mp3\u001b[0m\n",
      "g_{ij} =\n",
      " Matrix([\n",
      "[                           0,                           -1, (\u001b[0;34mP1\u001b[0m.\u001b[0;34ma\u001b[0m)],\n",
      "[                          -1,                            0, (\u001b[0;34mP2\u001b[0m.\u001b[0;34ma\u001b[0m)],\n",
      "[(\u001b[0;34mP1\u001b[0m.\u001b[0;34ma\u001b[0m), (\u001b[0;34mP2\u001b[0m.\u001b[0;34ma\u001b[0m),  (\u001b[0;34ma\u001b[0m.\u001b[0;34ma\u001b[0m)]])\n",
      "B**2 = 1\n",
      "a' = a-(a^B)*B = -(\u001b[0;34mP2\u001b[0m.\u001b[0;34ma\u001b[0m)*\u001b[0;34mP1\u001b[0m - (\u001b[0;34mP1\u001b[0m.\u001b[0;34ma\u001b[0m)*\u001b[0;34mP2\u001b[0m\n",
      "A+ = a'+a'*B = -2*(\u001b[0;34mP2\u001b[0m.\u001b[0;34ma\u001b[0m)*\u001b[0;34mP1\u001b[0m\n",
      "A- = a'-a'*B = -2*(\u001b[0;34mP1\u001b[0m.\u001b[0;34ma\u001b[0m)*\u001b[0;34mP2\u001b[0m\n",
      "(A+)^2 = 0\n",
      "(A-)^2 = 0\n",
      "a|B = -(\u001b[0;34mP2\u001b[0m.\u001b[0;34ma\u001b[0m)*\u001b[0;34mP1\u001b[0m + (\u001b[0;34mP1\u001b[0m.\u001b[0;34ma\u001b[0m)*\u001b[0;34mP2\u001b[0m\n",
      "g_{ij} =\n",
      " Matrix([\n",
      "[                            1, (\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m), (\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m)],\n",
      "[(\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m),                             1, (\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m)],\n",
      "[(\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m), (\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m),                             1]])\n",
      "E = \u001b[0;34me1\u001b[0m^\u001b[0;34me2\u001b[0m^\u001b[0;34me3\u001b[0m\n",
      "E**2 = (\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m)**2 - 2*(\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m)*(\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m)*(\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m) + (\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m)**2 + (\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m)**2 - 1\n",
      "E1 = (e2^e3)*E = ((\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m)**2 - 1)*\u001b[0;34me1\u001b[0m + ((\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m) - (\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m)*(\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m))*\u001b[0;34me2\u001b[0m + (-(\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m)*(\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m) + (\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m))*\u001b[0;34me3\u001b[0m\n",
      "E2 =-(e1^e3)*E = ((\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m) - (\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m)*(\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m))*\u001b[0;34me1\u001b[0m + ((\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m)**2 - 1)*\u001b[0;34me2\u001b[0m + (-(\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m)*(\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m) + (\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m))*\u001b[0;34me3\u001b[0m\n",
      "E3 = (e1^e2)*E = (-(\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m)*(\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m) + (\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m))*\u001b[0;34me1\u001b[0m + (-(\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m)*(\u001b[0;34me1\u001b[0m.\u001b[0;34me3\u001b[0m) + (\u001b[0;34me2\u001b[0m.\u001b[0;34me3\u001b[0m))*\u001b[0;34me2\u001b[0m + ((\u001b[0;34me1\u001b[0m.\u001b[0;34me2\u001b[0m)**2 - 1)*\u001b[0;34me3\u001b[0m\n",
      "E1|e2 = 0\n",
      "E1|e3 = 0\n",
      "E2|e1 = 0\n",
      "E2|e3 = 0\n",
      "E3|e1 = 0\n",
      "E3|e2 = 0\n",
      "(E1|e1)/E**2 = 1\n",
      "(E2|e2)/E**2 = 1\n",
      "(E3|e3)/E**2 = 1\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "terminal_check.py:6: DeprecationWarning: The `galgebra.deprecated` module is deprecated\n",
      "  from galgebra.deprecated import MV\n",
      "terminal_check.py:13: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','mv')\n",
      "terminal_check.py:19: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  X = MV('X','vector')\n",
      "terminal_check.py:20: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  Y = MV('Y','vector')\n",
      "terminal_check.py:35: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  X = MV('X','vector')\n",
      "terminal_check.py:36: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','spinor')\n",
      "terminal_check.py:49: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  X = MV('X','vector')\n",
      "terminal_check.py:50: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','spinor')\n",
      "terminal_check.py:90: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  f = MV('f','scalar',fct=True)\n",
      "terminal_check.py:91: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n",
      "terminal_check.py:92: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','grade2',fct=True)\n",
      "terminal_check.py:93: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  C = MV('C','mv',fct=True)\n",
      "terminal_check.py:123: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  f = MV('f','scalar',fct=True)\n",
      "terminal_check.py:124: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  A = MV('A','vector',fct=True)\n",
      "terminal_check.py:125: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  B = MV('B','grade2',fct=True)\n",
      "terminal_check.py:267: DeprecationWarning: The `galgebra.deprecated.MV` class is deprecated in favor of `galgebra.mv.Mv`.\n",
      "  a = MV(sym_lst,'vector')\n"
     ]
    }
   ],
   "source": [
    "run('terminal_check')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
